/*
 * بالعربي: شكل صفحة المقالة الواحدة: الهيدر الغامق، الصورة، النص بعرض مريح للقراية، المشاركة، و«مقالات أخرى».
 * English: Styles a single article: dark header, featured picture, readable text column, share links and «مقالات أخرى».
 *
 * One article (single.php, pages/article/, Stage 5).
 *
 * Rhythm: dark header (like the other pages' heroes) → the featured picture,
 * half on the dark scene and half on the page → the text in a readable
 * measure, with the reading stem at the side of the screen → what it is
 * about + share → «مقالات أخرى» on grey → the CTA.
 *
 * Logical properties only (RTL / LTR from one file, D-08).
 */

.gb-main--article {
	padding-block: 0;
}

/* The article's column: the readable measure, centred. */
.gb-article-header__inner,
.gb-article-body .gb-container,
.gb-article-footer .gb-container {
	inline-size: min(100% - (var(--gb-gutter) * 2), var(--gb-container-prose));
}

/* ---------- Header ---------- */

.gb-article-header {
	/* Dark scene: light focus ring and light text (as .gb-page-hero). */
	--gb-focus: var(--gb-focus-inverse);
	--gb-section-text: var(--gb-scene-text);
	--gb-section-muted: var(--gb-scene-text-muted);

	padding-block: var(--gb-space-2xl) var(--gb-space-xl);
	background-color: var(--gb-scene-bg);
	background-image: radial-gradient(60% 70% at 50% 30%, var(--gb-scene-glow), transparent 70%);
	color: var(--gb-scene-text);
}

/* With a picture, the dark scene goes on under its top half. */
.gb-article-header--picture {
	padding-block-end: calc(var(--gb-space-xl) + var(--gb-article-overlap));
}

.gb-article-header__inner {
	display: grid;
	justify-items: start;
	gap: var(--gb-space-xs);
}

/* The article's own title is long: the last breadcrumb stays on one line. */
.gb-article-header .gb-breadcrumbs {
	margin-block-end: var(--gb-space-2xs);
}

.gb-article-header .gb-breadcrumbs__current {
	display: inline-block;
	max-inline-size: min(28ch, 60vw);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	vertical-align: bottom;
}

.gb-article-header__cat {
	margin: 0;
}

.gb-article-header__cat a {
	display: inline-flex;
	align-items: center;
	min-block-size: 2rem;
	padding-inline: 0.85em;
	border-radius: var(--gb-radius-pill);
	background-color: var(--gb-color-turquoise-a20);
	color: var(--gb-primary);
	font-size: var(--gb-step--1);
	font-weight: var(--gb-weight-bold);
	text-decoration: none;
	transition: background-color var(--gb-duration-fast) linear;
}

.gb-article-header__cat a:hover {
	background-color: var(--gb-color-turquoise-a35);
}

.gb-article-header__title {
	margin: 0;
	font-family: var(--gb-font-display);
	font-size: var(--gb-step-5);
	line-height: 1.25;
	color: var(--gb-scene-text);
	text-wrap: balance;
}

.gb-article-header__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35em 0.6em;
	margin: 0;
	font-size: var(--gb-step--1);
	color: var(--gb-scene-text-muted);
}

.gb-article-header__lead {
	margin: var(--gb-space-2xs) 0 0;
	font-size: var(--gb-step-1);
	line-height: 1.7;
	color: var(--gb-scene-text-muted);
}

/* ---------- The featured picture ---------- */

:root {
	--gb-article-overlap: clamp(4rem, 12vw, 9rem);
}

.gb-article-picture {
	margin: calc(var(--gb-article-overlap) * -1) 0 0;
}

.gb-article-picture__inner {
	inline-size: min(100% - (var(--gb-gutter) * 2), 60rem);
}

.gb-article-picture__image {
	display: block;
	inline-size: 100%;
	block-size: auto;
	max-block-size: 34rem;
	object-fit: cover;
	border-radius: var(--gb-radius-l);
	background-color: var(--gb-surface);
	box-shadow: 0 2.5rem 4rem -3rem rgb(12 35 66 / 0.7);
}

.gb-article-picture__caption {
	margin-block-start: var(--gb-space-2xs);
	font-size: var(--gb-step--1);
	color: var(--gb-text-muted);
	text-align: center;
}

/* ---------- The text ---------- */

.gb-article-body {
	padding-block: var(--gb-space-xl) var(--gb-space-l);
}

.gb-article-prose {
	--gb-flow-space: var(--gb-space-s);

	max-inline-size: none;
	font-size: var(--gb-step-1);
	line-height: 1.95;
	color: var(--gb-text);
}

.gb-article-prose > :first-child {
	margin-block-start: 0;
}

.gb-article-prose h2,
.gb-article-prose h3,
.gb-article-prose h4 {
	--gb-flow-space: var(--gb-space-l);

	font-family: var(--gb-font-display);
	line-height: 1.4;
	color: var(--gb-color-navy);
	text-wrap: balance;
}

.gb-article-prose h2 {
	font-size: var(--gb-step-3);
}

.gb-article-prose h3 {
	font-size: var(--gb-step-2);
}

.gb-article-prose h4 {
	font-size: var(--gb-step-1);
}

/* A heading and its first paragraph stay close. */
.gb-article-prose :is(h2, h3, h4) + * {
	--gb-flow-space: var(--gb-space-2xs);
}

.gb-article-prose a {
	color: var(--gb-color-navy);
	text-decoration: underline;
	text-decoration-color: var(--gb-primary);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.3em;
}

.gb-article-prose a:hover {
	text-decoration-color: var(--gb-seed);
}

.gb-article-prose strong {
	font-weight: var(--gb-weight-bold);
	color: var(--gb-color-navy);
}

.gb-article-prose ul,
.gb-article-prose ol {
	padding-inline-start: 1.4em;
}

.gb-article-prose li + li {
	margin-block-start: 0.4em;
}

.gb-article-prose ul li::marker {
	color: var(--gb-primary);
}

.gb-article-prose ol li::marker {
	font-weight: var(--gb-weight-bold);
	color: var(--gb-color-navy);
}

/* A quote: the Growth Line beside it, the seed at its start. */
.gb-article-prose blockquote {
	position: relative;
	margin-inline: 0;
	padding-block: var(--gb-space-2xs);
	padding-inline-start: var(--gb-space-m);
	border-inline-start: 3px solid var(--gb-primary);
	font-family: var(--gb-font-display);
	font-size: var(--gb-step-2);
	line-height: 1.6;
	color: var(--gb-color-navy);
}

.gb-article-prose blockquote::before {
	content: "";
	position: absolute;
	inset-block-start: -0.35rem;
	inset-inline-start: -0.5rem;
	inline-size: 0.7rem;
	aspect-ratio: 1;
	border-radius: 50%;
	background-color: var(--gb-seed);
}

.gb-article-prose blockquote p {
	margin: 0;
}

.gb-article-prose blockquote cite {
	display: block;
	margin-block-start: var(--gb-space-2xs);
	font-family: var(--gb-font-sans);
	font-size: var(--gb-step--1);
	font-style: normal;
	color: var(--gb-text-muted);
}

.gb-article-prose figure {
	margin-inline: 0;
}

.gb-article-prose img {
	display: block;
	max-inline-size: 100%;
	block-size: auto;
	border-radius: var(--gb-radius-m);
}

.gb-article-prose figcaption {
	margin-block-start: var(--gb-space-2xs);
	font-size: var(--gb-step--1);
	color: var(--gb-text-muted);
	text-align: center;
}

.gb-article-prose hr {
	inline-size: 4rem;
	margin-inline: auto;
	border: 0;
	border-block-start: 2px solid var(--gb-color-turquoise-a35);
}

/* Tables scroll on their own on a phone (the block editor wraps them in a figure). */
.gb-article-prose .wp-block-table {
	overflow-x: auto;
}

.gb-article-prose table {
	inline-size: 100%;
	border-collapse: collapse;
	font-size: var(--gb-step-0);
	line-height: 1.6;
}

.gb-article-prose th,
.gb-article-prose td {
	padding: 0.6em 0.8em;
	border-block-end: 1px solid var(--gb-border);
	text-align: start;
}

.gb-article-prose th {
	font-weight: var(--gb-weight-bold);
	color: var(--gb-color-navy);
}

.gb-article-prose code {
	padding: 0.1em 0.35em;
	border-radius: var(--gb-radius-s);
	background-color: var(--gb-surface);
	font-size: 0.9em;
}

/* ---------- The reading stem ---------- */

/*
 * At the side of the screen (the reading end: left in Arabic, right in
 * English), from near the bottom up to near the top. --gb-read (0…1, set by
 * reading.js) is how much of it has grown. The seed sits at its foot; the
 * bloom waits at its top and opens with data-gb-bloom.
 */
.gb-reading-stem {
	--gb-read: 0;
	--gb-stem-gap: clamp(0.35rem, 2vw, 1.75rem);

	position: fixed;
	z-index: 20;
	inset-block: 5.5rem 1.5rem;
	inset-inline-end: var(--gb-stem-gap);
	inline-size: 1.75rem;
	pointer-events: none;
}

.gb-reading-stem[hidden] {
	display: none;
}

/* The stem: a faint track, and the grown part over it. */
.gb-reading-stem::before,
.gb-reading-stem__line {
	content: "";
	position: absolute;
	inset-block: 1.25rem 0.55rem;
	inset-inline-start: 50%;
	inline-size: 2px;
	margin-inline-start: -1px;
	border-radius: 2px;
}

.gb-reading-stem::before {
	background-color: var(--gb-color-turquoise-a20);
}

.gb-reading-stem__line {
	background-color: var(--gb-primary);
	box-shadow: 0 0 0.5rem var(--gb-color-turquoise-a35);
	transform-origin: 50% 100%;
	scale: 1 var(--gb-read);
}

/* The seed at the foot. */
.gb-reading-stem__seed {
	position: absolute;
	inset-block-end: 0;
	inset-inline-start: 50%;
	inline-size: 0.7rem;
	aspect-ratio: 1;
	margin-inline-start: -0.35rem;
	border-radius: 50%;
	background-color: var(--gb-seed);
	box-shadow: 0 0 0 3px var(--gb-bg);
}

/* The bloom at the top: the logo's arrow head and two leaves, closed until the end. */
.gb-reading-stem__bloom {
	position: absolute;
	inset-block-start: -0.9rem;
	inset-inline-start: 50%;
	inline-size: 3rem;
	block-size: 3rem;
	margin-inline-start: -1.5rem;
	overflow: visible;
}

.gb-reading-stem__head {
	fill: var(--gb-primary);
	transform-box: fill-box;
	transform-origin: 50% 100%;
	scale: 0;
	transition: scale var(--gb-duration-base) var(--gb-ease-out);
}

.gb-reading-stem__leaf {
	fill: var(--gb-color-turquoise-a60);
	transform-box: fill-box;
	transform-origin: 50% 100%;
	scale: 0;
	transition: scale var(--gb-duration-slow) var(--gb-ease-organic);
}

.gb-reading-stem[data-gb-bloom] .gb-reading-stem__head,
.gb-reading-stem[data-gb-bloom] .gb-reading-stem__leaf {
	scale: 1;
}

.gb-reading-stem[data-gb-bloom] .gb-reading-stem__leaf--b {
	transition-delay: 80ms;
}

/* The finished stem breathes once: a ring of light round the bloom. */
.gb-reading-stem[data-gb-bloom] .gb-reading-stem__bloom {
	animation: gb-stem-bloom var(--gb-duration-slow) var(--gb-ease-out) 1;
}

@keyframes gb-stem-bloom {
	0% {
		filter: drop-shadow(0 0 0 transparent);
	}

	50% {
		filter: drop-shadow(0 0 0.6rem var(--gb-color-turquoise-a60));
	}

	100% {
		filter: drop-shadow(0 0 0 transparent);
	}
}

/* A phone: thinner, right at the edge, so it never covers the text. */
@media (max-width: 40rem) {
	.gb-reading-stem {
		inset-block: 4.5rem 1rem;
		inset-inline-end: 0.1rem;
		inline-size: 0.6rem;
	}

	.gb-reading-stem__seed {
		inline-size: 0.45rem;
		margin-inline-start: -0.225rem;
	}

	.gb-reading-stem__bloom {
		inline-size: 1.6rem;
		block-size: 1.6rem;
		margin-inline-start: -0.8rem;
		inset-block-start: -0.3rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.gb-reading-stem__head,
	.gb-reading-stem__leaf {
		transition: none;
	}

	.gb-reading-stem[data-gb-bloom] .gb-reading-stem__bloom {
		animation: none;
	}
}

/* ---------- What it is about + share ---------- */

.gb-article-footer {
	padding-block: 0 var(--gb-space-2xl);
}

.gb-article-footer__inner {
	display: grid;
	gap: var(--gb-space-m);
	padding-block-start: var(--gb-space-m);
	border-block-start: 1px solid var(--gb-border);
}

.gb-article-about {
	display: grid;
	gap: var(--gb-space-s);
	margin: 0;
}

.gb-article-about__group {
	display: grid;
	gap: var(--gb-space-3xs);
}

.gb-article-about dt {
	font-size: var(--gb-step--1);
	font-weight: var(--gb-weight-bold);
	color: var(--gb-text-muted);
}

.gb-article-about dd {
	margin: 0;
}

.gb-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gb-chip {
	display: inline-flex;
	align-items: center;
	min-block-size: 2.25rem;
	padding-inline: 0.9em;
	border: 1px solid var(--gb-border);
	border-radius: var(--gb-radius-pill);
	background-color: var(--gb-bg);
	color: var(--gb-text);
	font-size: var(--gb-step--1);
	text-decoration: none;
}

.gb-chip--link {
	color: var(--gb-color-navy);
	transition: border-color var(--gb-duration-fast) linear, background-color var(--gb-duration-fast) linear;
}

.gb-chip--link:hover {
	border-color: var(--gb-primary);
	background-color: var(--gb-color-turquoise-a10);
}

.gb-chip--tag::before {
	content: "#";
	margin-inline-end: 0.15em;
	color: var(--gb-primary);
}

.gb-article-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--gb-space-2xs) var(--gb-space-s);
}

.gb-article-share__title {
	margin: 0;
	font-weight: var(--gb-weight-bold);
	color: var(--gb-color-navy);
}

.gb-article-share__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gb-article-share__button {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	min-block-size: 2.75rem;
	padding-inline: 1em;
	border: 1px solid var(--gb-border);
	border-radius: var(--gb-radius-pill);
	background-color: var(--gb-bg);
	color: var(--gb-color-navy);
	font: inherit;
	font-size: var(--gb-step--1);
	text-decoration: none;
	cursor: pointer;
	transition: border-color var(--gb-duration-fast) linear, background-color var(--gb-duration-fast) linear;
}

.gb-article-share__button[hidden] {
	display: none;
}

.gb-article-share__button:hover {
	border-color: var(--gb-primary);
	background-color: var(--gb-color-turquoise-a10);
}

.gb-article-share__button[data-gb-copied-now] {
	border-color: var(--gb-primary);
	background-color: var(--gb-color-turquoise-a20);
}

.gb-article-share__button .gb-icon {
	inline-size: 1.15em;
	block-size: 1.15em;
}

/* WhatsApp, X, LinkedIn: round, the icon only (the name is for screen readers). */
.gb-article-share__button--icon {
	justify-content: center;
	inline-size: 2.75rem;
	padding-inline: 0;
}

.gb-article-share__button--icon .gb-icon {
	inline-size: 1.25rem;
	block-size: 1.25rem;
}

/* ---------- «مقالات أخرى» ---------- */

.gb-article-related {
	padding-block: var(--gb-space-2xl);
	background-color: var(--gb-surface);
}
