/* ==========================================================================
   ELHELB Agri Library — "Bibliotheca Agraria"  (v1.4.0)
   خزانة المعرفة الزراعية: رفوف مخطوطات، بطاقة فهرسة، فهرس بنقاط الوصل،
   وقارئ بصفحة مخطوطة (نهاري / ليلي).
   كل الألوان مشتقة من ألوان الإعدادات (الأساسي + الذهبي) فتبقى الهوية ثابتة.
   ========================================================================== */

.eac-lib,
.eac-reader,
.eac-single {
	--ink-d: color-mix(in srgb, var(--p, #0B2F6B) 78%, #02060f);
	--ink-m: color-mix(in srgb, var(--p, #0B2F6B) 55%, #000);
	--brass: color-mix(in srgb, var(--a, #F5A623) 68%, #5e4010);
	--foil: color-mix(in srgb, var(--a, #F5A623) 58%, #f6e3a8);
	--paper: #f7f2e7;
	--paper-hi: #fffdf7;
	--rule: color-mix(in srgb, var(--brass) 36%, transparent);
	--serif: 'Amiri', 'Noto Naskh Arabic', 'Scheherazade New', 'Traditional Arabic', 'Times New Roman', serif;
	--latin: 'Cormorant Garamond', 'Cormorant', Georgia, 'Times New Roman', serif;
	--noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .33 0 0 0 0 .18 0 0 0 .075 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* theme-proof buttons inside the library */
:where(.eac-app .eac-lib) button,
:where(.eac-app .eac-reader) button {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.eac-app .eac-lib button:focus-visible,
.eac-app .eac-reader button:focus-visible {
	outline: 2px solid var(--brass);
	outline-offset: 3px;
}

/* ---------- the folio (page frame) ---------- */
.eac-lib {
	position: relative;
	isolation: isolate;
	padding: clamp(22px, 4vw, 52px) clamp(16px, 3.4vw, 46px) clamp(26px, 4vw, 52px);
	border-radius: 26px;
	background: var(--noise), radial-gradient(900px 380px at 50% -8%, #fffdf6, transparent 70%), var(--paper);
	border: 1px solid var(--rule);
	box-shadow: 0 34px 60px -34px rgba(11, 47, 107, .45), inset 0 0 0 7px var(--paper), inset 0 0 0 8px var(--rule);
	color: #1d2433;
}

/* title page */
.eac-lib-title { text-align: center; max-width: 760px; margin: 0 auto 30px; }
.eac-lib-star { display: block; width: 40px; height: 40px; margin: 0 auto 10px; color: var(--brass); }
.eac-lib-star * { fill: none; stroke: currentColor; stroke-width: 1.1; }
.eac-lib-kicker {
	display: inline-flex; align-items: center; gap: 14px; direction: ltr;
	font: 600 12.5px/1 var(--latin); letter-spacing: .36em; text-transform: uppercase; color: var(--brass);
}
.eac-lib-kicker::before, .eac-lib-kicker::after { content: ""; width: 44px; height: 1px; background: var(--rule); }
.eac-lib-title h3 {
	margin: 14px 0 10px; font: 700 clamp(30px, 5vw, 50px)/1.35 var(--serif); color: var(--ink-d); text-wrap: balance;
}
.eac-lib-title p { margin: 0; font: 400 clamp(16px, 2vw, 19px)/1.9 var(--serif); color: #5a5446; }
.eac-lib-count { display: inline-flex; gap: 22px; margin-top: 16px; padding: 7px 24px; border-block: 1px solid var(--rule); direction: ltr; }
.eac-lib-count span { font: 600 13px/1 var(--latin); letter-spacing: .22em; text-transform: uppercase; color: var(--brass); }
.eac-lib-count b { font: 700 22px/1 var(--latin); color: var(--ink-d); margin-inline-end: 6px; letter-spacing: 0; }

/* tools: catalogue search · level ruler · view switch */
.eac-lib-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 28px; margin: 0 0 14px; }
.eac-lib-find { position: relative; flex: 1 1 260px; min-width: 0; }
.eac-lib-find svg { position: absolute; inset-inline-start: 2px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; fill: none; stroke: var(--brass); stroke-width: 1.5; stroke-linecap: round; pointer-events: none; }
.eac-lib .eac-lq {
	display: block; width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--brass); border-radius: 0; background: transparent; box-shadow: none;
	padding: 10px 30px 10px 4px; padding-inline-start: 30px; font: 400 18px/1.6 var(--serif); color: var(--ink-d); outline: none; transition: box-shadow .3s;
}
.eac-lib .eac-lq::placeholder { color: #8d8470; }
.eac-lib .eac-lq:focus { box-shadow: 0 2px 0 0 var(--brass); }
.eac-lib-ruler, .eac-lib-view { display: inline-flex; align-items: stretch; gap: 0; }
.eac-app .eac-lib-ruler button, .eac-app .eac-lib-view button {
	background: transparent; border: 0; border-radius: 0; box-shadow: none; text-shadow: none; position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; font: 700 14.5px/1.4 var(--eac-font, inherit); color: #7a715c; transition: color .25s;
}
.eac-lib-ruler button + button::before, .eac-lib-view button + button::before { content: ""; position: absolute; inset-inline-start: 0; top: 28%; bottom: 28%; width: 1px; background: var(--rule); }
.eac-lib-ruler button::after, .eac-lib-view button::after {
	content: ""; position: absolute; inset-inline: 12px; bottom: 3px; height: 2px; background: var(--brass); transform: scaleX(0); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.eac-app .eac-lib-ruler button:hover, .eac-app .eac-lib-view button:hover { color: var(--ink-d); background: transparent; }
.eac-app .eac-lib-ruler button.on, .eac-app .eac-lib-view button.on { color: var(--ink-d); }
.eac-lib-ruler button.on::after, .eac-lib-view button.on::after { transform: scaleX(1); }
.eac-lib-view svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* categories as chapter tabs */
.eac-lib-cats { display: flex; flex-wrap: wrap; gap: 2px 4px; margin: 0 0 26px; padding: 0; border-block: 1px solid var(--rule); }
.eac-app .eac-lib-cats button {
	background: transparent; border: 0; border-radius: 0; box-shadow: none; text-shadow: none; position: relative; display: inline-flex; align-items: center; gap: 9px; padding: 11px 14px; font: 700 14.5px/1.4 var(--eac-font, inherit); color: #6b634f; transition: color .25s, background-color .25s;
}
.eac-lib-cats button i { font: 600 12px/1 var(--latin); font-style: normal; letter-spacing: .1em; color: var(--brass); direction: ltr; }
.eac-app .eac-lib-cats button:hover { color: var(--ink-d); background: color-mix(in srgb, var(--brass) 8%, transparent); }
.eac-app .eac-lib-cats button.on, .eac-app .eac-lib-cats button.on:hover { color: var(--ink-d); }
.eac-lib-cats button.on::after { content: ""; position: absolute; inset-inline: 10px; bottom: -1px; height: 3px; background: var(--brass); }
.eac-em { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- frontispiece (featured) ---------- */
.eac-app .eac-front {
	position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: clamp(16px, 3vw, 34px); width: 100%; margin: 0 0 30px;
	padding: clamp(20px, 3vw, 34px) clamp(18px, 3.4vw, 44px); text-align: start; color: #f3e8cd;
	background: radial-gradient(520px 240px at 100% 0, color-mix(in srgb, var(--a, #F5A623) 22%, transparent), transparent 65%), linear-gradient(135deg, var(--ink-m), var(--ink-d));
	box-shadow: 0 26px 44px -26px rgba(5, 15, 40, .7), inset 0 0 0 1px rgba(255, 255, 255, .06), inset 0 0 0 7px transparent, inset 0 0 0 8px color-mix(in srgb, var(--foil) 45%, transparent);
	transition: transform .4s cubic-bezier(.2, .8, .2, 1), box-shadow .4s;
}
.eac-app .eac-front:hover { transform: translateY(-4px); }
.eac-front-em { display: grid; place-items: center; width: clamp(78px, 11vw, 124px); aspect-ratio: 1; border: 1px solid color-mix(in srgb, var(--foil) 55%, transparent); border-radius: 50%; color: var(--foil); position: relative; }
.eac-front-em::before { content: ""; position: absolute; inset: 7px; border: 1px dashed color-mix(in srgb, var(--foil) 45%, transparent); border-radius: 50%; animation: eacRot 90s linear infinite; }
.eac-front-em .eac-em { width: 46%; height: 46%; stroke-width: 1.1; }
.eac-front small { display: block; font: 600 12.5px/1.4 var(--latin); letter-spacing: .3em; text-transform: uppercase; color: var(--foil); direction: ltr; text-align: start; }
.eac-front b { display: block; margin: 8px 0 6px; font: 700 clamp(24px, 3.4vw, 38px)/1.45 var(--serif); color: #fff; text-wrap: balance; }
.eac-front p { margin: 0 0 12px; max-width: 62ch; font: 400 17.5px/1.95 var(--serif); color: rgba(243, 232, 205, .86); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.eac-front i { font: 700 14.5px/1 var(--eac-font, inherit); font-style: normal; color: var(--foil); border-bottom: 1px solid color-mix(in srgb, var(--foil) 55%, transparent); padding-bottom: 4px; }

/* ---------- the cabinet (shelves view) ---------- */
.eac-cab-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 316px; gap: 26px; align-items: start; }
.eac-cab {
	position: relative; isolation: isolate; padding: clamp(18px, 2.4vw, 30px) clamp(14px, 2.2vw, 28px) 12px; border-radius: 14px; overflow: hidden;
	background: radial-gradient(700px 320px at 80% -6%, color-mix(in srgb, var(--a, #F5A623) 12%, transparent), transparent 62%), linear-gradient(165deg, var(--ink-m), var(--ink-d) 70%);
	box-shadow: 0 34px 50px -30px rgba(3, 10, 30, .85), inset 0 0 0 1px rgba(255, 255, 255, .06), inset 0 0 0 9px transparent, inset 0 0 0 10px color-mix(in srgb, var(--foil) 38%, transparent);
}
.eac-cab::after { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; background: linear-gradient(112deg, rgba(255, 255, 255, .075), transparent 26%, transparent 64%, rgba(255, 255, 255, .035)); }
.eac-shelf { position: relative; margin-bottom: 26px; }
.eac-shelf-plate { display: flex; align-items: center; gap: 12px; margin: 0 4px 12px; color: var(--foil); }
.eac-shelf-plate i { font: 700 15px/1 var(--latin); font-style: normal; letter-spacing: .14em; direction: ltr; opacity: .9; }
.eac-shelf-plate b { font: 700 16px/1.4 var(--serif); color: #f6ecd3; }
.eac-shelf-plate .eac-em { width: 19px; height: 19px; }
.eac-shelf-plate::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, color-mix(in srgb, var(--foil) 50%, transparent), transparent); }
.eac-shelf-plate em { font: 600 12px/1 var(--latin); font-style: normal; letter-spacing: .2em; opacity: .7; direction: ltr; order: 3; }
.eac-shelf-plate.cont b { font-weight: 400; opacity: .6; font-size: 14px; }
.eac-books { display: flex; align-items: flex-end; gap: 5px; padding: 0 12px; min-height: 140px; }
.eac-shelf-board {
	position: relative; height: 15px; margin: 0 -6px; border-radius: 2px;
	background: linear-gradient(180deg, color-mix(in srgb, var(--foil) 80%, #fff) 0, var(--brass) 38%, color-mix(in srgb, var(--brass) 55%, #000) 100%);
	box-shadow: 0 14px 18px -6px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.eac-shelf-board::after { content: ""; position: absolute; inset-inline: 0; top: 100%; height: 22px; background: linear-gradient(rgba(0, 0, 0, .35), transparent); pointer-events: none; }

/* the spine */
.eac-app .eac-bk {
	border: 0; --spine: color-mix(in srgb, var(--c, #0B2F6B) 56%, #0a1226);
	position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between; flex: none;
	width: var(--w, 54px); height: var(--h, 214px); padding: 11px 0 12px; box-sizing: border-box; border-radius: 3px 3px 1px 1px; color: #f1e3bd;
	background: linear-gradient(90deg, rgba(0, 0, 0, .42), rgba(255, 255, 255, .1) 16%, rgba(255, 255, 255, 0) 38%, rgba(0, 0, 0, .3)), repeating-linear-gradient(0deg, rgba(255, 255, 255, .028) 0 1px, transparent 1px 3px), var(--spine);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), inset 0 2px 0 rgba(255, 255, 255, .12), 7px 0 14px -7px rgba(0, 0, 0, .7);
	transform-origin: 50% 100%; transition: transform .5s cubic-bezier(.2, .9, .25, 1), box-shadow .5s, filter .35s;
	animation: eacBkIn .7s calc(var(--i, 0) * 38ms) cubic-bezier(.2, .8, .2, 1) backwards;
}
@keyframes eacBkIn { from { opacity: 0; transform: translateY(30px) rotate(1.5deg); } }
.eac-bk-no { font: 700 11.5px/1 var(--latin); letter-spacing: .08em; color: var(--foil); direction: ltr; opacity: .9; }
.eac-bk-t {
	writing-mode: vertical-rl; flex: 1 1 0; min-height: 0; max-height: 100%; margin: 9px 0; padding: 11px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
	border-block: 3px double color-mix(in srgb, var(--foil) 70%, transparent); font: 700 15.5px/1.25 var(--serif); color: #f8edd2; text-align: start;
}
.eac-bk .eac-em { width: 19px; height: 19px; color: var(--foil); opacity: .92; stroke-width: 1.2; }
.eac-bk.ft::after { content: ""; position: absolute; top: -4px; inset-inline-end: 9px; width: 11px; height: 30px; background: linear-gradient(180deg, var(--foil), var(--brass)); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .45)); }
.eac-books:hover .eac-bk:not(:hover):not(.sel) { filter: brightness(.78) saturate(.9); }
.eac-bk:hover, .eac-bk:focus-visible, .eac-bk.sel { transform: translateY(-20px); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foil) 55%, transparent), inset 0 2px 0 rgba(255, 255, 255, .2), 7px 24px 28px -10px rgba(0, 0, 0, .75); filter: none; z-index: 3; }

/* the catalogue card */
.eac-card {
	position: sticky; top: 18px; padding: 22px 22px 54px; border-radius: 4px; color: #1d2433;
	background: repeating-linear-gradient(transparent 0 33px, color-mix(in srgb, var(--p, #0B2F6B) 13%, transparent) 33px 34px) 0 62px / 100% 100% no-repeat, var(--noise), var(--paper-hi);
	box-shadow: 0 26px 40px -24px rgba(11, 47, 107, .55), 0 2px 0 rgba(0, 0, 0, .04), inset 0 0 0 1px var(--rule);
}
.eac-card.flip { animation: eacCard .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes eacCard { from { opacity: .2; transform: translateY(10px) rotateX(10deg); } }
.eac-card::before { content: ""; position: absolute; inset-inline: 22px; top: 52px; height: 1px; background: #b3392f; opacity: .55; }
.eac-cd-hd { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 14px; margin-bottom: 11px; }
.eac-cd-hd b { font: 600 12px/1 var(--latin); letter-spacing: .3em; text-transform: uppercase; color: var(--brass); direction: ltr; }
.eac-cd-hd em { font: 700 20px/1 var(--latin); font-style: normal; color: var(--ink-d); direction: ltr; }
.eac-cd-f { margin: 0; display: grid; grid-template-columns: 78px minmax(0, 1fr); column-gap: 10px; }
.eac-cd-f dt { font: 700 12.5px/34px var(--eac-font, inherit); color: var(--brass); }
.eac-cd-f dd { margin: 0; font: 400 16.5px/34px var(--serif); color: var(--ink-d); }
.eac-cd-f dd.t { font: 700 20px/34px var(--serif); line-height: 34px; }
.eac-cd-ex { margin: 12px 0 14px; font: 400 16.5px/34px var(--serif); color: #3d4252; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.eac-app .eac-cd-go { border: 0; border-radius: 0; box-shadow: none; display: inline-flex; align-items: center; gap: 8px; padding: 9px 20px; background: var(--ink-d); color: #f6ecd3; font: 700 14.5px/1.4 var(--eac-font, inherit); transition: background .3s, transform .3s; }
.eac-app .eac-cd-go:hover { background: var(--brass); transform: translateX(-4px); }
.eac-cd-hole { position: absolute; bottom: 14px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #d9d1bd, #f0e9d6); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .3), 0 1px 0 #fff; }

/* ---------- the index (catalogue with dotted leaders) ---------- */
.eac-ix-g { margin: 0 0 34px; }
.eac-ix-g > h4 { display: flex; align-items: center; gap: 14px; margin: 0 0 4px; font: 700 21px/1.5 var(--serif); color: var(--ink-d); }
.eac-ix-g > h4 i { font: 600 14px/1 var(--latin); font-style: normal; letter-spacing: .18em; color: var(--brass); direction: ltr; }
.eac-ix-g > h4 .eac-em { color: var(--brass); width: 22px; height: 22px; }
.eac-ix-g > h4::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.eac-ix-g ul { list-style: none; margin: 0; padding: 0; }
.eac-app .eac-ix-row {
	position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: start; background: transparent; border-radius: 0; box-shadow: none; text-align: start; width: 100%; padding: 15px 4px 15px 10px; border-bottom: 1px solid color-mix(in srgb, var(--brass) 18%, transparent);
	transition: background-color .35s, padding .35s cubic-bezier(.2, .8, .2, 1); animation: eacLibIn .55s calc(var(--i, 0) * 30ms) cubic-bezier(.2, .8, .2, 1) backwards;
}
@keyframes eacLibIn { from { opacity: 0; transform: translateY(14px); } }
.eac-app .eac-ix-row::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--brass); transform: scaleY(0); transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
.eac-app .eac-ix-row:hover, .eac-app .eac-ix-row:focus-visible { background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--brass) 8%, transparent)); padding-inline-start: 22px; }
.eac-app .eac-ix-row:hover::before, .eac-app .eac-ix-row:focus-visible::before { transform: scaleY(1); }
.eac-ix-n { font: 600 22px/1.7 var(--latin); color: color-mix(in srgb, var(--brass) 80%, transparent); direction: ltr; text-align: start; letter-spacing: .04em; }
.eac-ix-main { display: flex; flex-direction: column; min-width: 0; }
.eac-ix-line { display: flex; align-items: baseline; gap: 10px; }
.eac-ix-line b { flex: 0 1 auto; font: 700 clamp(19px, 2.3vw, 24px)/1.6 var(--serif); color: var(--ink-d); transition: color .3s; }
.eac-ix-row:hover .eac-ix-line b { color: var(--brass); }
.eac-ix-lead { flex: 1 1 24px; min-width: 18px; align-self: end; margin-bottom: .62em; border-bottom: 2px dotted color-mix(in srgb, var(--brass) 55%, transparent); }
.eac-ix-line em { flex: none; font: 600 13.5px/1.4 var(--eac-font, inherit); font-style: normal; color: #7a715c; white-space: nowrap; }
.eac-ix-main small { margin-top: 2px; max-width: 72ch; font: 400 16px/1.85 var(--serif); color: #5a5446; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.eac-empty-lib { text-align: center; padding: 44px 10px; font: 400 19px/1.9 var(--serif); color: #6b634f; }

/* ---------- the reader: manuscript page ---------- */
.eac-reader { position: fixed; inset: 0; z-index: 100000; overflow-y: auto; overscroll-behavior: contain; animation: eacFade .35s; }
.eac-reader[hidden] { display: none; }
.eac-reader {
	--rd-bg: var(--paper); --rd-ink: #262b38; --rd-strong: var(--ink-d); --rd-mut: #6e6652; --rd-rule: var(--rule); --rd-brass: var(--brass); --fs: 21px;
	background: var(--noise), radial-gradient(1100px 420px at 50% -6%, #fffdf6, transparent 70%), var(--rd-bg); color: var(--rd-ink); scroll-behavior: smooth;
}
.eac-reader[data-fs="1"] { --fs: 18.5px; }
.eac-reader[data-fs="3"] { --fs: 24px; }
.eac-reader[data-th="night"] {
	--rd-bg: #0b1222; --rd-ink: #e6dfcc; --rd-strong: #fbf3dc; --rd-mut: #9aa3ba; --rd-rule: rgba(236, 200, 128, .26); --rd-brass: var(--foil);
	background: radial-gradient(1100px 420px at 50% -6%, rgba(236, 200, 128, .08), transparent 70%), var(--rd-bg);
}
.eac-reader-bar { position: sticky; top: 0; z-index: 8; height: 3px; margin-bottom: -3px; background: transparent; }
.eac-reader-bar i { background: linear-gradient(90deg, var(--brass), var(--foil)); }
.eac-rd-bar {
	position: sticky; top: 0; z-index: 7; display: flex; align-items: center; gap: 12px; padding: 12px clamp(14px, 3vw, 30px);
	background: color-mix(in srgb, var(--rd-bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--rd-rule);
}
.eac-rd-bar:empty { display: none; }
.eac-app .eac-rd-x, .eac-app .eac-rd-t {
	display: inline-grid; place-items: center; width: 40px; height: 40px; background: transparent; border: 1px solid var(--rd-rule); border-radius: 50%; box-shadow: none; color: var(--rd-strong); transition: background-color .25s, color .25s, transform .3s;
}
.eac-app .eac-rd-x:hover, .eac-app .eac-rd-t:hover { background: var(--rd-brass); color: var(--rd-bg); }
.eac-app .eac-rd-x:hover { transform: rotate(90deg); }
.eac-rd-x svg, .eac-rd-t svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.eac-rd-t span { font: 700 15px/1 var(--serif); }
.eac-rd-t.sm span { font-size: 13px; }
.eac-rd-t.lg span { font-size: 19px; }
.eac-rd-crumb { display: inline-flex; align-items: center; gap: 9px; flex: 1; min-width: 0; font: 700 14.5px/1.4 var(--eac-font, inherit); color: var(--rd-brass); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eac-rd-tools { display: inline-flex; gap: 8px; }

.eac-reader-in { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 90px; }
.eac-rd-head { max-width: 820px; margin: 0 auto; padding: clamp(34px, 7vw, 86px) 0 26px; text-align: center; }
.eac-rd-kicker { display: inline-flex; align-items: center; gap: 14px; direction: ltr; font: 600 12.5px/1 var(--latin); letter-spacing: .34em; text-transform: uppercase; color: var(--rd-brass); }
.eac-rd-kicker::before, .eac-rd-kicker::after { content: ""; width: 52px; height: 1px; background: var(--rd-rule); }
.eac-rd-head h2 { margin: 18px 0 14px; font: 700 clamp(30px, 5.4vw, 56px)/1.45 var(--serif); color: var(--rd-strong); text-wrap: balance; }
.eac-rd-lede { margin: 0 auto 18px; max-width: 60ch; font: 400 clamp(17px, 2vw, 21px)/2 var(--serif); color: var(--rd-mut); }
.eac-rd-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 0; font: 600 14.5px/1.6 var(--eac-font, inherit); color: var(--rd-mut); }
.eac-rd-meta span + span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 16px; background: var(--rd-brass); transform: rotate(45deg); vertical-align: middle; }
.eac-rd-orn { display: block; width: min(240px, 60%); height: 20px; margin: 26px auto 0; color: var(--rd-brass); fill: none; stroke: currentColor; stroke-width: 1; }
.eac-rd-orn circle, .eac-rd-orn path.f { fill: currentColor; stroke: none; }

.eac-rd-grid { display: grid; grid-template-columns: minmax(0, 720px) 230px; grid-template-areas: "main toc"; gap: 56px; justify-content: center; align-items: start; margin-top: 22px; }
.eac-rd-main { grid-area: main; min-width: 0; }
.eac-toc { grid-area: toc; position: sticky; top: 84px; display: block; padding: 0 20px 0 0; padding-inline: 18px 0; border-inline-start: 1px solid var(--rd-rule); border-radius: 0; background: transparent; font: 600 14.5px/1.7 var(--eac-font, inherit); counter-reset: tocn; }
.eac-toc > b { display: block; margin-bottom: 10px; font: 600 12px/1 var(--latin); letter-spacing: .3em; text-transform: uppercase; color: var(--rd-brass); }
.eac-toc a { position: relative; display: flex; gap: 10px; padding: 6px 0; color: var(--rd-mut); text-decoration: none; transition: color .25s, padding .3s; }
.eac-toc a::before { counter-increment: tocn; content: counter(tocn, upper-roman); flex: none; min-width: 2.2em; font: 600 13px/1.9 var(--latin); letter-spacing: .08em; color: var(--rd-brass); direction: ltr; text-align: start; }
.eac-toc a:hover { color: var(--rd-strong); }
.eac-toc a.on { color: var(--rd-strong); padding-inline-start: 6px; }
.eac-toc a.on::after { content: ""; position: absolute; inset-inline-start: -19px; top: 12px; width: 3px; height: 22px; background: var(--rd-brass); transform: translateY(-4px); }
.eac-rd-pct { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rd-rule); font: 600 13px/1.4 var(--eac-font, inherit); color: var(--rd-mut); }
.eac-rd-pct b { font: 700 26px/1 var(--latin); color: var(--rd-strong); margin-inline-end: 4px; letter-spacing: 0; }

/* shared manuscript typography (reader + single article page) */
:is(.eac-reader .eac-prose, .eac-single.eac-prose) {
	--rd-ink: #262b38; --rd-strong: var(--ink-d); --rd-mut: #6e6652; --rd-rule: var(--rule); --rd-brass: var(--brass);
	counter-reset: sec tbl; font-family: var(--serif); font-size: var(--fs, 21px); line-height: 2.1; color: var(--rd-ink); text-align: start; overflow-wrap: break-word;
}
.eac-reader[data-th="night"] :is(.eac-prose) { --rd-ink: #e6dfcc; --rd-strong: #fbf3dc; --rd-mut: #9aa3ba; --rd-brass: var(--foil); --rd-rule: rgba(236, 200, 128, .26); }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) p { margin: 0 0 1.05em; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) > p:first-child { font-size: 1.1em; color: var(--rd-strong); padding-inline-start: 20px; border-inline-start: 2px solid var(--rd-brass); }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) h2 {
	counter-increment: sec; margin: 2.1em 0 .7em; padding: 0 0 .45em; border: 0; border-bottom: 1px solid var(--rd-rule); font: 700 1.5em/1.55 var(--serif); color: var(--rd-strong); scroll-margin-top: 84px;
}
:is(.eac-reader .eac-prose, .eac-single.eac-prose) h2::before { content: "§ " counter(sec, upper-roman); display: block; margin-bottom: .1em; font: 600 .5em/1.6 var(--latin); letter-spacing: .34em; color: var(--rd-brass); direction: ltr; text-align: start; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) h3, :is(.eac-reader .eac-prose, .eac-single.eac-prose) h4 { margin: 1.6em 0 .4em; font: 700 1.14em/1.6 var(--serif); color: var(--rd-strong); }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) strong { color: var(--rd-strong); }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) a { color: var(--rd-brass); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) ul, :is(.eac-reader .eac-prose, .eac-single.eac-prose) ol { list-style: none; margin: 0 0 1.2em; padding: 0; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) li { position: relative; margin: 0 0 .5em; padding-inline-start: 2.1em; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) ul > li::before { content: ""; position: absolute; inset-inline-start: .45em; top: 1.02em; width: .36em; height: .36em; background: var(--rd-brass); transform: rotate(45deg); }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) ol { counter-reset: li; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) ol > li { counter-increment: li; padding-inline-start: 2.7em; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) ol > li::before { content: counter(li); position: absolute; inset-inline-start: 0; top: .5em; display: grid; place-items: center; width: 1.9em; height: 1.9em; border: 1px solid var(--rd-brass); border-radius: 50%; font: 700 .74em/1 var(--latin); color: var(--rd-brass); letter-spacing: 0; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) li::marker { content: ""; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) blockquote { margin: 1.6em 0; padding: .2em 1.4em; border-inline-start: 2px solid var(--rd-brass); font-size: 1.06em; color: var(--rd-strong); }

/* tables: booktabs */
:is(.eac-reader .eac-prose, .eac-single.eac-prose) .eac-tw { position: relative; margin: 2.4em 0 1.8em; padding-top: 1.9em; overflow-x: auto; border: 0; border-radius: 0; counter-increment: tbl; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) .eac-tw::before { content: "جدول " counter(tbl); position: absolute; top: 0; inset-inline-start: 0; font: 700 .62em/1.4 var(--eac-font, inherit); letter-spacing: .08em; color: var(--rd-brass); }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) table { width: 100%; border-collapse: collapse; border-block: 2px solid var(--rd-strong); font-family: var(--eac-font, inherit); font-size: .72em; line-height: 1.85; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) th { background: transparent; color: var(--rd-strong); text-align: start; white-space: normal; padding: 12px 14px; font-weight: 800; border-bottom: 1px solid var(--rd-strong); }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) td { padding: 11px 14px; border-top: 1px solid var(--rd-rule); vertical-align: top; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) tr:nth-child(even) td { background: transparent; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) tbody tr { transition: background-color .25s; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) tbody tr:hover td { background: color-mix(in srgb, var(--rd-brass) 9%, transparent); }

/* callouts as marginal notes */
:is(.eac-reader .eac-prose, .eac-single.eac-prose) .eac-callout { position: relative; margin: 2em 0; padding: 1.15em 1.5em .9em; background: color-mix(in srgb, var(--rd-brass) 6%, transparent); border: 0; border-block: 1px solid var(--rd-rule); border-radius: 0; font-size: .92em; }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) .eac-callout::before { content: "هامش"; position: absolute; top: -.8em; inset-inline-start: 1.3em; padding: 0 .7em; background: var(--rd-bg, var(--paper)); font: 800 .72em/1.6 var(--eac-font, inherit); letter-spacing: .14em; color: var(--rd-brass); }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) .eac-callout.eac-warn { background: color-mix(in srgb, var(--r, #D0312D) 6%, transparent); border-color: color-mix(in srgb, var(--r, #D0312D) 45%, transparent); }
:is(.eac-reader .eac-prose, .eac-single.eac-prose) .eac-callout.eac-warn::before { content: "تنبيه"; color: var(--r, #D0312D); }
.eac-single.eac-prose { --rd-bg: var(--paper); padding: clamp(18px, 3vw, 34px); background: var(--noise), var(--paper); border: 1px solid var(--rule); }

/* bibliography */
.eac-srcs { margin: 64px 0 0; padding: 0; background: transparent; border-radius: 0; }
.eac-srcs h4 { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; font: 700 20px/1.5 var(--serif); color: var(--rd-strong); }
.eac-srcs h4::after { content: ""; flex: 1; height: 1px; background: var(--rd-rule); }
.eac-bib { list-style: none; margin: 0; padding: 0; counter-reset: bib; }
.eac-bib li { counter-increment: bib; display: grid; grid-template-columns: 3em minmax(0, 1fr); gap: 4px; padding: 8px 0; font: 600 15px/1.8 var(--eac-font, inherit); color: var(--rd-ink); border-bottom: 1px dotted var(--rd-rule); }
.eac-bib li::before { content: "[" counter(bib) "]"; font: 700 15px/1.8 var(--latin); color: var(--rd-brass); direction: ltr; text-align: start; }
.eac-bib a { color: var(--rd-ink); text-decoration: none; border-bottom: 1px solid var(--rd-brass); }
.eac-bib a:hover { color: var(--rd-brass); }
.eac-bib small { display: block; font: 600 12.5px/1.6 var(--latin); letter-spacing: .08em; color: var(--rd-mut); direction: ltr; text-align: start; }

/* footer: actions + colophon */
.eac-rd-acts { display: flex; flex-wrap: wrap; gap: 10px; margin: 38px 0 0; }
.eac-app .eac-rd-acts button { display: inline-flex; background: transparent; border-radius: 0; box-shadow: none; padding: 10px 22px; border: 1px solid var(--rd-brass); color: var(--rd-strong); font: 700 14.5px/1.4 var(--eac-font, inherit); transition: background-color .3s, color .3s; }
.eac-app .eac-rd-acts button:hover { background: var(--rd-brass); color: var(--rd-bg); }
.eac-rd-colo { margin: 48px 0 0; text-align: center; color: var(--rd-mut); font: 600 12.5px/1.8 var(--latin); letter-spacing: .26em; text-transform: uppercase; }
.eac-rd-colo svg { display: block; width: min(200px, 50%); height: 18px; margin: 0 auto 10px; color: var(--rd-brass); fill: none; stroke: currentColor; stroke-width: 1; }
.eac-rd-colo svg circle, .eac-rd-colo svg path.f { fill: currentColor; stroke: none; }

/* ---------- responsive ---------- */
@media (max-width: 1099px) {
	.eac-cab-wrap { grid-template-columns: minmax(0, 1fr); }
	.eac-card { position: relative; top: 0; order: -1; }
	.eac-rd-grid { grid-template-columns: minmax(0, 720px); grid-template-areas: "toc" "main"; gap: 22px; }
	.eac-toc { position: static; padding: 14px 18px; border: 1px solid var(--rd-rule); background: color-mix(in srgb, var(--rd-brass) 5%, transparent); }
	.eac-toc a.on::after, .eac-rd-pct { display: none; }
}
@media (max-width: 699px) {
	.eac-lib { border-radius: 18px; padding-inline: 14px; }
	.eac-lib-view { display: none; }
	.eac-lib-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
	.eac-lib-cats button { flex: none; }
	.eac-app .eac-front { grid-template-columns: minmax(0, 1fr); }
	.eac-front-em { width: 64px; }
	.eac-app .eac-ix-row { grid-template-columns: 38px minmax(0, 1fr); }
	.eac-ix-n { font-size: 17px; }
	.eac-ix-lead { display: none; }
	.eac-ix-line { flex-direction: column; gap: 0; }
	.eac-rd-crumb { font-size: 13px; }
}

/* ---------- motion, print ---------- */
.eac-noanim .eac-bk, .eac-noanim .eac-ix-row, .eac-noanim .eac-card.flip, .eac-noanim .eac-front-em::before { animation: none !important; }
.eac-noanim .eac-reader { scroll-behavior: auto; }
@media (prefers-reduced-motion: reduce) { .eac-bk, .eac-ix-row, .eac-card.flip, .eac-front-em::before { animation: none !important; } }
@media print {
	html.eac-printing .eac-reader { background: #fff !important; color: #000 !important; --rd-ink: #000; --rd-strong: #000; --rd-bg: #fff; }
	html.eac-printing .eac-rd-bar, html.eac-printing .eac-rd-acts, html.eac-printing .eac-toc, html.eac-printing .eac-reader-bar { display: none !important; }
	html.eac-printing .eac-rd-grid { display: block; }
}
