/*
 * أنطولوجي — طبقة الهوية
 * هوية أنطولوجي · الإصدار الأول · ٧ سبتمبر ٢٠٢٦
 *
 * الحكم الحاكم: «الوجود لا يقع جنسًا». الحدود تُصنِّف، والمحور يمرّ فيها كلِّها.
 * ومنه: الأزرق لا يقع إلا على المحور، وألوان الأبواب تُصنِّف ولا تلامسه.
 *
 * هذا الملف يعرّف المفردات وحدها. كل ما بعده يستهلكها ولا يعيد كتابة لونٍ خامًا.
 */

:root {
	/* ─ الألوان الخمسة ─ لا سادس لها */
	--ant-paper:  #EFECE4; /* ورق الرواق  — سطح المطبوع، وحبر الكتابة على الليليّ */
	--ant-carbon: #16161A; /* كربون       — حبر المطبوع وحدود العلامة. لا يُستعمل سطحًا */
	--ant-night:  #0A1330; /* أزرق أنطولوجي — السطح الليليّ */
	--ant-klein:  #002FA7; /* أزرق كلاين  — المحور على الورق. لا يقع على غيره */
	--ant-lift:   #5C82F0; /* أزرق الشاشة — المحور على الليليّ */
	--ant-gold-season: #C9A85C; /* الذهبيّ القديم — خرج من العلامة، ويعود موسمًا فقط */

	/* ─ السطح: ورق الرواق ─ */
	--ant-ground: var(--ant-paper);
	--ant-ink:    var(--ant-carbon);
	--ant-mute:   #6B6A63;
	--ant-rule:   #BCB8AC;
	--ant-faint:  #D2CDBE;
	--ant-panel:  #F6F4EE;   /* سطحٌ مرفوع فوق الورق — بديل الأبيض الناصع */
	--ant-panel-2:#E9E5DB;
	--ant-shade:  rgba(10, 19, 48, 0.10);
	--ant-shade-2:rgba(10, 19, 48, 0.16);

	/* المحور — اللون الحاكم. يتبع السطح ولا يتبع القسم */
	--ant-axis: var(--ant-klein);

	/* لون الباب: يُحقن من محرّك الأقسام، ويسقط إلى الحبر إن غاب.
	   يُصنِّف ولا يلمس العلامة ولا الشعار النصي. */
	--ant-accent: var(--antolgy-section, var(--ant-ink));

	/* ─ الطباعة: أربعة خطوط بأربعة أدوار ─
	   كورير برايم يتقدّم المكدّس فيلتقط اللاتينية والأرقام وحدها،
	   ولا يحمل حرفًا عربيًا فتسقط العربية إلى الخط الذي يليه. */
	--ant-title: "Courier Prime", "Kawkab Mono", ui-monospace, monospace;
	--ant-body:  "Amiri", serif;
	--ant-mono:  "Courier Prime", ui-monospace, "Courier New", monospace;

	/* ─ الأشكال: خطوطٌ لا أقراص ─ */
	--ant-radius: 0px;
	--ant-radius-pill: 0px;
	--ant-hairline: 1px solid var(--ant-rule);
}

/* ─ السطح الليليّ ─ الشاشة تتبع تفضيل القارئ، وله أن يُثبِّته ـ */
@media (prefers-color-scheme: dark) {
	:root:not([data-antolgy-surface="paper"]) {
		--ant-ground: var(--ant-night);
		--ant-ink:    var(--ant-paper);
		--ant-mute:   #8B93AB;
		--ant-rule:   #28324F;
		--ant-faint:  #1B2646;
		--ant-panel:  #101B3D;
		--ant-panel-2:#16224A;
		--ant-shade:  rgba(0, 0, 0, 0.50);
		--ant-shade-2:rgba(0, 0, 0, 0.50);
		--ant-axis:   var(--ant-lift);
	}
}

:root[data-antolgy-surface="night"] {
	--ant-ground: var(--ant-night);
	--ant-ink:    var(--ant-paper);
	--ant-mute:   #8B93AB;
	--ant-rule:   #28324F;
	--ant-faint:  #1B2646;
	--ant-panel:  #101B3D;
	--ant-panel-2:#16224A;
	--ant-shade:  rgba(0, 0, 0, 0.50);
	--ant-shade-2:rgba(0, 0, 0, 0.50);
	--ant-axis:   var(--ant-lift);
}

/* ─────────────────────────────────────────────────────────────
   العلامة — «المراتب» وحالتها المفتوحة «الشجرة»
   الحدود تأخذ لون الحبر الجاري، والمحور وحده يأخذ الأزرق.
   ───────────────────────────────────────────────────────────── */
.antolgy-mark {
	display: block;
	flex: none;
	height: auto;
	color: var(--ant-ink);
}

.antolgy-mark .antolgy-mark__bounds {
	fill: none;
	stroke: currentColor;
	stroke-width: 16;
	stroke-linecap: round;
}

/* الاختزال: أدقّ المراتب أوّل ما يسقط، والحدّ الأوسع والمحور لا يسقطان */
.antolgy-mark--single .antolgy-mark__bounds { stroke-width: 30; }
.antolgy-mark--three  .antolgy-mark__bounds { stroke-width: 20; }

/* المحور: لا يتلوّن بغير أزرق كلاين أو أزرق الشاشة، ولا يُقصّ، ولا يُخفى */
.antolgy-mark .antolgy-mark__axis {
	fill: var(--ant-axis);
	stroke: none;
}

/* العلامة على مساحةٍ ليليةٍ مصمتة داخل صفحةٍ ورقية */
.antolgy-on-night .antolgy-mark,
.antolgy-mark--on-night {
	color: var(--ant-paper);
}

.antolgy-on-night .antolgy-mark .antolgy-mark__axis,
.antolgy-mark--on-night .antolgy-mark__axis {
	fill: var(--ant-lift);
}

/* ─ القفل: العلامة يمينًا والاسم يسارها، والفاصل نصف عرض العلامة ─ */
.antolgy-lock {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	text-decoration: none;
	color: inherit;
}

.antolgy-lock__name {
	font-family: var(--ant-title);
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0;
	color: inherit;
}

.antolgy-lock__latin {
	display: block;
	font-family: var(--ant-mono);
	font-weight: 700;
	font-size: 0.62em;
	letter-spacing: 0.4em;
	direction: ltr;
	color: var(--ant-mute);
	margin-top: 0.35em;
}

/* ─ سطحٌ ليليّ مصمت داخل الورق (بطاقة اقتباس، مقدمة، ترويسة) ─ */
.antolgy-on-night {
	background: var(--ant-night);
	color: var(--ant-paper);
	--ant-ink: var(--ant-paper);
	--ant-mute: #8B93AB;
	--ant-rule: #28324F;
	--ant-axis: var(--ant-lift);
}

/* ─────────────────────────────────────────────────────────────
   الأشكال — خطوطٌ لا أقراص، وخيطٌ لا ظلّ
   ───────────────────────────────────────────────────────────── */
body :is(
	.antolgy-card,
	.antolgy-person-card,
	.antolgy-quote-card,
	.antolgy-person-index-card,
	.antolgy-directory-person,
	.antolgy-country-card,
	.antolgy-overlay__card,
	.antolgy-category-description
) {
	border-radius: var(--ant-radius);
}

/* الشعر لا يُكسر: إن ضاق العرض صغُر الخطّ ولم يُقسم البيت */
.wp-block-verse,
.antolgy-single-content .wp-block-verse {
	font-family: var(--ant-body);
	white-space: pre-wrap;
	overflow-wrap: normal;
}

/* ─────────────────────────────────────────────────────────────
   القفل في مواضعه
   ───────────────────────────────────────────────────────────── */
.antolgy-header__lock {
	align-items: center;
}

.antolgy-header__mark {
	display: inline-flex;
	align-items: center;
	color: var(--ant-ink);
	text-decoration: none;
}

/* الفاصل بين العلامة والاسم: نصف عرض العلامة */
.antolgy-header__lock .wp-block-site-title {
	margin: 0;
	font-family: var(--ant-title);
	font-weight: 700;
	letter-spacing: 0;
}

.antolgy-header__lock .wp-block-site-title a {
	text-decoration: none;
}

.antolgy-footer__lock {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	margin-bottom: 1.5rem;
	color: var(--ant-ink);
	text-align: start;
}

.antolgy-footer__lock .antolgy-lock__name {
	font-family: var(--ant-title);
	font-weight: 700;
	font-size: 1.05rem;
	line-height: 1.1;
}

.antolgy-footer__lock .antolgy-lock__latin {
	font-size: 0.5rem;
	letter-spacing: 0.28em;
}

.antolgy-dock-brand .antolgy-lock {
	justify-content: center;
	gap: 0.4rem;
	font-size: 1rem;
}

.antolgy-dock-brand .antolgy-lock__name {
	font-family: var(--ant-title);
	font-size: 0.95rem;
}

/* ─── الشارات واللاتينية الصغيرة ─── كورير ٧٠٠ بتباعد ٠٫٤em ─── */
.section-header .section-tag,
.antolgy-beta-badge,
.antolgy-beta-hero {
	font-family: var(--ant-title);
	letter-spacing: 0;
}

.antolgy-person-index-card__name-en,
.person-shortlink,
.antolgy-country-card__count {
	font-family: var(--ant-mono);
	font-style: normal;
}

/* ─────────────────────────────────────────────────────────────
   الطباعة في أدوارها
   كوكب مونو يُعنوِن ويُسمّي ولا يُستعمل متنًا أبدًا.
   أميري متنُ الرواق والاقتباس: الشعر يُقرأ بأميري لا بغيره.
   ───────────────────────────────────────────────────────────── */
body :is(h1, h2, h3, h4, h5, h6),
body :is(
	.wp-block-site-title,
	.wp-block-post-title,
	.wp-block-query-title,
	.section-title,
	.archive-title,
	.section-tag,
	.card-category,
	.person-name,
	.antolgy-lock__name
),
body .wp-block-navigation .wp-block-navigation-item__content,
body .wp-block-button__link,
body .antolgy-navigation-list a {
	font-family: var(--ant-title);
}

body :is(
	.wp-block-post-content,
	.wp-block-post-excerpt,
	.antolgy-single-content,
	.antolgy-category-description,
	.wp-block-quote,
	.wp-block-pullquote,
	blockquote
) {
	font-family: var(--ant-body);
}

/* الشارات والوسوم — كوكب ٤٠٠ */
.section-header .section-tag {
	font-weight: 400;
}

/* اللاتينية الصغيرة — كورير ٧٠٠ بتباعد ٠٫٤em */
.antolgy-lock__latin,
.antolgy-beta-badge,
.antolgy-beta-hero {
	font-family: var(--ant-mono);
	font-weight: 700;
	letter-spacing: 0.18em;
}

/* ─────────────────────────────────────────────────────────────
   إيقاع كوكب مونو
   كوكب خطٌّ ثابت العرض، وصعودُه ونزولُه عاليان لأنه يحمل التشكيل.
   فالسطر الذي يسع أميري لا يسعه: يُوسَّع ما بين السطور، ويُخفَّض
   المقاس، لأن العربية في الثابت أعرض من العربية في المتناسب بنحو الثلث.
   ───────────────────────────────────────────────────────────── */
:root {
	--ant-title-lh: 1.6;   /* ما بين السطور في العنونة */
	--ant-lock-lh: 1.15;   /* الشعار النصي — سطرٌ واحد لا تشكيل فيه */
}

body :is(h1, h2, h3, h4, h5, h6),
body :is(
	.wp-block-site-title,
	.wp-block-post-title,
	.wp-block-query-title,
	.section-title,
	.archive-title,
	.person-name,
	.antolgy-directory-person h2,
	.antolgy-person-index-card__name
) {
	line-height: var(--ant-title-lh);
	letter-spacing: 0;
	text-wrap: balance;
}

/* مقاسات العنونة — من ٣٠ إلى ٥٢px للعنوان الأول، ثم نازلة */
body .antolgy-single-header .wp-block-post-title,
body .antolgy-archive-header .archive-title,
body .wp-block-post-content h1 {
	font-size: clamp(1.5rem, 3.4vw, 2.5rem) !important;
	line-height: 1.72;
}

body .wp-block-post-content :is(h2, h3, h4) {
	line-height: 1.6;
	margin-block: 2.2em 0.9em;
}

body .wp-block-post-content h2 { font-size: clamp(1.25rem, 2.4vw, 1.75rem); }
body .wp-block-post-content h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }
body .wp-block-post-content h4 { font-size: clamp(1rem, 1.7vw, 1.2rem); }

/* الشعار في الهيرو — كبيرٌ لكن ليس بعرض الشاشة */
body .antolgy-hero-section .wp-block-site-title {
	font-size: clamp(2.25rem, 5.5vw, 4.25rem) !important;
	line-height: 1.35;
}

/* عنوان البطاقة — سطرٌ يسع التشكيل ولا يخنقه */
body .antolgy-card .wp-block-post-title,
body .antolgy-person-index-card__name,
body .antolgy-directory-person h2 {
	line-height: 1.65;
}

/* القفل والشارات: سطرٌ واحد بلا تشكيل، فلا يحتاج ما تحتاجه العنونة */
.antolgy-lock__name,
.antolgy-header__lock .wp-block-site-title,
.antolgy-footer__lock .antolgy-lock__name,
.section-header .section-tag,
.card-category,
.antolgy-breadcrumbs {
	line-height: var(--ant-lock-lh);
}

.antolgy-breadcrumbs {
	line-height: 1.9;
}

/* رأس الصفحة: العلامة والاسم على خطٍّ واحد مهما اختلفت مقاييس الخط */
.antolgy-header__lock .wp-block-site-title,
.antolgy-header__lock .wp-block-site-title a {
	display: inline-block;
	line-height: var(--ant-lock-lh);
}

/* المسافة بين العنوان وما يليه — تُقاس من الحرف لا من صندوق الخط */
.antolgy-single-header {
	padding-block: 3rem 1.5rem;
}

.antolgy-single-header .wp-block-post-title {
	margin-block: 0.35em 0.5em;
}

.section-header .section-title {
	line-height: 1.45;
}

/* البطاقة: عنوانٌ ثابت العرض يحتاج هامشًا أوسع أسفله */
.antolgy-card .card-body .wp-block-post-title {
	margin-block: 0.15em 0.6em;
}

/* لون الباب على خيط البطاقة داخل قسمه */
[class*="section-"] .antolgy-card {
	border-top-color: var(--antolgy-door, var(--ant-ink));
}

/* لون الباب على عنوان الأرشيف وشارة القسم داخل المقال */
body.antolgy-themed .antolgy-archive-header .archive-title,
body.antolgy-themed .antolgy-single-header .card-category a {
	color: var(--antolgy-section);
}

/* الأفاتار البديل: خطٌّ لا قرص — الحرف بالحبر على الورق */
.antolgy-person-index-card__photo--placeholder {
	background: var(--ant-panel) !important;
	border: 1px solid var(--antolgy-card-accent, var(--ant-accent));
}

.antolgy-person-index-card__initials {
	color: var(--antolgy-card-accent, var(--ant-ink));
	font-family: var(--ant-title);
}

/* ─── رواق أنطولوجي · واجهة القارئ ─────────────────────────── */
:is(.antolgy-portico, .antolgy-threshold) :is(
	.antolgy-threshold__title,
	.antolgy-chapter__title,
	.antolgy-toc__title,
	.antolgy-toc__part,
	.antolgy-card__title,
	.antolgy-shelf__title,
	.antolgy-gate__title,
	.antolgy-afterword__title,
	.antolgy-nav__title,
	.antolgy-cast__name
) {
	font-family: var(--ant-title);
	line-height: 1.5;
	letter-spacing: 0;
}

/* متن الكتاب يُقرأ بأميري لا بغيره */
:is(.antolgy-portico, .antolgy-threshold) :is(.antolgy-body, .antolgy-body p, .antolgy-body li, .antolgy-body blockquote, .antolgy-toc__excerpt) {
	font-family: var(--ant-body);
}

/* الشارات والأرقام في الرواق — كورير */
:is(.antolgy-portico, .antolgy-threshold) :is(.antolgy-chapter__meta, .antolgy-card__meta, .antolgy-threshold__stats) {
	font-family: var(--ant-mono);
}

/* العلامة في شريط القارئ */
.antolgy-bar__mark {
	display: inline-flex;
	align-items: center;
	flex: none;
	margin-inline-end: 0.6rem;
	color: currentColor;
}

.antolgy-bar__mark .antolgy-mark__axis {
	fill: var(--ant-lift);
}

/* ─── بلوكات ووردبريس الأساسية: خطوطٌ لا أقراص ─────────────── */
body :is(
	.wp-block-search__input,
	.wp-block-search__button,
	.wp-block-button__link,
	.wp-block-file__button,
	input[type="text"],
	input[type="search"],
	input[type="email"],
	textarea,
	select
) {
	border-radius: var(--ant-radius);
}

body .wp-block-search__input {
	border: var(--ant-hairline);
	background: var(--ant-panel);
	color: var(--ant-ink);
	font-family: var(--ant-body);
}

body .wp-block-search__button {
	background: var(--ant-ink);
	color: var(--ant-ground);
	border: 1px solid var(--ant-ink);
	font-family: var(--ant-title);
}

body .wp-block-search .wp-block-search__label {
	font-family: var(--ant-title);
	color: var(--ant-mute);
}

/* الاقتباس في المتن: خيطٌ على الحافّة لا صندوق ملوّن */
body .wp-block-post-content blockquote,
body blockquote.wp-block-quote {
	border-inline-start: 2px solid var(--ant-accent);
	background: transparent;
	padding-inline-start: 1.25rem;
}

/* الصور: بلا استدارة */
body .wp-block-post-featured-image img,
body .wp-block-image img {
	border-radius: var(--ant-radius);
}

/* الخطّ الفاصل بين الأقسام */
.section-divider {
	background: var(--ant-rule);
}

.section-header .section-line {
	background: var(--ant-rule);
	opacity: 1;
}

/* اسم الموقع في الرأس يتبع الحبر الجاري: كربونًا على الورق، وورقًا على الليليّ */
.antolgy-header__lock .wp-block-site-title,
.antolgy-header__lock .wp-block-site-title a,
.antolgy-header__lock .wp-block-site-title a:hover {
	color: var(--ant-ink);
}

/* ─── عنوان القسم مع كوكب ───────────────────────────────────
   كوكب ثابت العرض: العنوان الذي كان يسع سطرًا في بيروت يتجاوز
   عرض الجوال هنا. فيُسمح له بالالتفاف بدل أن يدفع الصفحة أفقيًّا.
   ───────────────────────────────────────────────────────── */
.section-header {
	flex-wrap: wrap;
	row-gap: 0.5rem;
}

.section-header .section-title {
	white-space: normal;
	overflow-wrap: anywhere;
	min-width: 0;
}

.section-header .section-tag {
	white-space: nowrap;
	flex: none;
}

@media (max-width: 600px) {
	.section-header .section-line {
		display: none;
	}

	.section-header .section-title {
		font-size: clamp(1rem, 4.6vw, 1.25rem);
	}
}

/* حزامُ أمان: لا تنزلق الصفحة أفقيًّا مهما اتّسع سطرٌ ثابت العرض */
html,
body {
	overflow-x: clip;
}

/* الفاصل في القفل = نصف عرض العلامة (هوية أنطولوجي §٤) */
.antolgy-header__lock {
	gap: 15px;
}

.antolgy-footer__lock {
	gap: 17px;
}

/* ─────────────────────────────────────────────────────────────
   الحال المفتوحة — الشجرة
   العلامة والشجرة حالتان لعشرة منحنيات: كل حدٍّ نصفان يلتقيان،
   فإذا فُكَّ اللقاء انفرجا زوجَ فروع. ولا تجتمعان في إطارٍ واحد.
   ───────────────────────────────────────────────────────────── */
.antolgy-mark--tree .antolgy-mark__bounds       { stroke-width: 18; }
.antolgy-mark--tree-short .antolgy-mark__bounds { stroke-width: 38; }   /* تُقرأ بحجم 30px */

/* المقدمة: الشجرة فوق الاسم على السطح الليليّ */
.antolgy-hero-mark {
	display: flex;
	justify-content: center;
	margin: 0 auto 0.25rem;
}

.antolgy-mark--hero {
	width: clamp(84px, 10vw, 132px);
	height: auto;
}

.antolgy-mark--hero .antolgy-mark__bounds { stroke-width: 14; }

/* «الحدُّ إذا انفتح» — فعلٌ واحد: الفروع تنبت من المحور والمحور لا يتحرّك.
   تنبت من الأدنى إلى الأعلى، ثم يمسّ الجذرُ الأرض آخرًا: الشخصُ وحده يمسّ الأرض. */
@media (prefers-reduced-motion: no-preference) {
	.antolgy-mark--hero .antolgy-mark__bounds {
		stroke-dasharray: 1;
		stroke-dashoffset: 1;
		animation: antolgy-branch 1.1s cubic-bezier(0.25, 0.6, 0.2, 1) forwards;
	}
	.antolgy-mark--hero .antolgy-mark__bounds:nth-of-type(1),
	.antolgy-mark--hero .antolgy-mark__bounds:nth-of-type(2)  { animation-delay: 0.20s; }
	.antolgy-mark--hero .antolgy-mark__bounds:nth-of-type(3),
	.antolgy-mark--hero .antolgy-mark__bounds:nth-of-type(4)  { animation-delay: 0.38s; }
	.antolgy-mark--hero .antolgy-mark__bounds:nth-of-type(5),
	.antolgy-mark--hero .antolgy-mark__bounds:nth-of-type(6)  { animation-delay: 0.56s; }
	.antolgy-mark--hero .antolgy-mark__bounds:nth-of-type(7),
	.antolgy-mark--hero .antolgy-mark__bounds:nth-of-type(8)  { animation-delay: 0.74s; }
	.antolgy-mark--hero .antolgy-mark__bounds:nth-of-type(9),
	.antolgy-mark--hero .antolgy-mark__bounds:nth-of-type(10) { animation-delay: 1.05s; }
}

@keyframes antolgy-branch {
	to { stroke-dashoffset: 0; }
}

/* شجرة المعرفة فوق عنوان الفهرس */
.antolgy-index-mark {
	display: flex;
	justify-content: center;
	margin: 0 auto 0.75rem;
}

.antolgy-mark--index {
	width: clamp(56px, 7vw, 84px);
	height: auto;
}

/* الغلاف الافتتاحي للكتاب */
.antolgy-threshold__mark {
	margin: 0 0 1rem;
}

.antolgy-threshold__mark .antolgy-mark {
	width: 52px;
	height: auto;
}

/* طبقتا الاستكشاف والبحث: إطارٌ مستقل يغطّي الصفحة، فعلامة الرأس تغيب
   كي لا تجتمع المراتب والشجرة في إطارٍ واحد */
.antolgy-overlay__tree {
	margin: 0 0 1rem;
}

.antolgy-overlay__tree .antolgy-mark {
	width: 56px;
	height: auto;
}

html.antolgy-overlay-open .antolgy-header {
	visibility: hidden;
}

/* الأشجار الصغيرة (دون 64px): خطٌّ أثخن كي لا يذوب في بكسلٍ واحد */
.antolgy-threshold__mark .antolgy-mark__bounds,
.antolgy-overlay__tree .antolgy-mark__bounds { stroke-width: 30; }
.antolgy-mark--index .antolgy-mark__bounds    { stroke-width: 22; }
.antolgy-threshold__mark .antolgy-mark        { width: 60px; }
