/* ════════════════════════════════════════════════════════════════════
 * library.css — «مكتبة تحفة» للجمهور (م-٢) · يُحمَّل بعد `site.css` في `library.php` وحدها (`$PAGE_CSS`)
 * ════════════════════════════════════════════════════════════════════
 * طلبُ سعود: «فخمة ورايقة» — خلفيّةٌ داكنةٌ دافئة (لا أسودَ خالص) · شبكةٌ مبرَّرة بأحجامٍ حقيقيّة لا مربّعاتٍ مقصوصة ·
 * مسافاتٌ واسعة · عناوينُ بثمانية Serif Display · حركةٌ بطيئة عند الظهور (وتُحترم «تقليل الحركة») · عارضٌ بملء الشاشة.
 *
 * 🔑 **الشبكةُ المبرَّرة بلا سكربت:** كلُّ خليّةٍ `flex-basis = النسبة × ارتفاع السطر` و`flex-grow` بالنسبة نفسِها (في
 *    `style`)، فيتمدّد السطرُ كلُّه بمعاملٍ واحد وتبقى ارتفاعاتُه متساوية — والارتفاعُ من `aspect-ratio` فلا قصّ.
 *    والسطرُ الأخيرُ لا يتمدّد (`::after` بنموٍّ هائل يبتلع فراغَه)، والتمدّدُ مسقوفٌ (×١٫٧) فلا تتضخّم صورةٌ وحيدة.
 * ⚠️ **`align-items: flex-start` لا `stretch`** — المدُّ في المحور المتقاطع يُسقط `aspect-ratio` في بعض المحرّكات.
 * ⚠️ **والظهورُ البطيء بالمخطّط الزمنيّ للتمرير حيث يُدعَم وحدَه** (`animation-timeline: view()`) — لا سكربتَ يُخفي
 *    المحتوى ثمّ يُظهره: إن تعذّر شيءٌ بقيت الصورُ ظاهرةً كما هي، وهو الاتجاهُ الآمن.
 * ⚠️ **والخطوطُ من الرموز وحدها** (`var(--jf-d, …)`) — `tests/fonts.php` يرفض مكدّساً مكتوباً بيد.
 * ════════════════════════════════════════════════════════════════════ */

.lib {
    --lib-bg:      #15110e;                    /* داكنٌ دافئ — بُنّيّ الظلّ لا أسود */
    --lib-bg-2:    #1c1714;
    --lib-surface: #241e1a;
    --lib-line:    rgba(255, 240, 225, 0.09);
    --lib-txt:     #f1e9df;
    --lib-mute:    rgba(241, 233, 223, 0.64);
    --lib-faint:   rgba(241, 233, 223, 0.42);
    --lib-accent:  var(--vmp-orange-light, #ff7700);
    --lib-serif:   var(--jf-d, 'Thmanyah Serif Display', 'Thmanyah Sans', Georgia, serif);
    --lib-ease:    cubic-bezier(0.22, 0.61, 0.36, 1);
    background: var(--lib-bg);
    color: var(--lib-txt);
    min-height: 70vh;
    padding-bottom: 72px;
}
/* الجسمُ كلُّه دافئٌ لا أسودُ الموقع — والذيلُ يبقى إطاراً أسود */
body:has(> main.lib) { background: #15110e; }

.lib a { color: inherit; }

/* 🔴 **`site.css` يكتب `section {…}` لأقسام الرئيسيّة** — `padding: 100px 50px · max-width: 1400px · margin: 0 auto`، وحتى
      ٧٦٨ `padding: 60px 15px !important` — فيرثه كلُّ `<section>` هنا: فجوةُ ١٠٠ بكسل وإزاحةُ ٥٠ قبل كلِّ عنوانٍ في تفاصيل
      الصورة (رُئي في العارض: «الكواليس» تحت فراغٍ بارتفاع ثلث الشاشة)، وحافّةُ الأقسام على الجوال أوسعُ من الرأس بـ١٥
      (١٥ + ١٦)، وسقفُ ١٤٠٠ يُلغي `lib-wrap--wide` (١٥٢٠). ⇒ **كنمط `pub.css`**: الصنفُ يغلب الوسمَ على الحاسب، و`!important`
      في المدى نفسِه على الجوال — **والعارضُ يُلحَق بالجسم لا بـ`.lib`** فقواعدُ تفاصيله بالصنف وحده لا بالأب. */
.lib-sec, .lib-det__sec { max-width: none; margin-inline: 0; }
.lib-det__sec { padding: 0; }
@media (max-width: 768px) {
    .lib-sec { padding: 52px 0 !important; }
    .lib-det__sec { padding: 0 !important; }
}
/* و«القسمُ التالي» (`_tail.php`) **ميّتٌ هنا** — يقفز بين `section[id]` وأقسامُ المكتبة بلا مراسٍ — ودائرةٌ برتقاليّةٌ عائمةٌ فوق
   الصور لا تفعل شيئاً. والشريطُ العلويّ يبقى. */
main.lib ~ .next-section-btn { display: none; }

.lib-wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.lib-wrap--wide { max-width: 1520px; }
.lib-wrap--story { max-width: 1040px; }

/* المعاينةُ للفريق — الصفحةُ مغلقةٌ للجمهور */
.lib-preview {
    position: relative; z-index: 5;
    margin: 104px auto 0; max-width: 900px; width: calc(100% - 32px);
    padding: 14px 20px; border-radius: 10px;
    background: rgba(255, 119, 0, 0.1); border: 1px solid rgba(255, 119, 0, 0.55);
    font-size: 0.92rem; line-height: 1.9;
}
.lib-preview a { color: var(--lib-accent); }

/* ═══ الرؤوس ═══ */
.lib-kicker { margin: 0 0 14px; color: var(--lib-accent); font-size: 0.92rem; font-weight: 500; letter-spacing: 0.02em; }
.lib-kicker a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .3s; }
.lib-kicker a:hover { border-bottom-color: currentColor; }
.lib-title {
    font-family: var(--lib-serif);
    font-weight: 500; line-height: 1.15; letter-spacing: -0.01em;
    font-size: clamp(2.5rem, 7.5vw, 5.4rem);
    margin: 0 0 22px; overflow-wrap: anywhere;
}
.lib-lead { max-width: 640px; margin: 0 0 22px; font-size: clamp(1.05rem, 2.2vw, 1.25rem); line-height: 2; color: var(--lib-mute); }
.lib-meta { margin: 0; color: var(--lib-faint); font-size: 0.95rem; }
.lib-en { margin: -12px 0 14px; color: var(--lib-mute); font-size: 1.05rem; letter-spacing: 0.04em; }

.lib-hero { padding: 150px 0 40px; }
.lib-preview + .lib-hero, .lib-preview + .lib-ahead, .lib-preview + .lib-shead { padding-top: 48px; }

.lib-sec { padding: 52px 0; }
.lib-h {
    display: flex; align-items: center; gap: 18px;
    font-family: var(--lib-serif);
    font-weight: 500; font-size: clamp(1.45rem, 3.2vw, 2rem);
    margin: 0 0 28px;
}
.lib-h::after { content: ''; flex: 1; height: 1px; background: var(--lib-line); }

.lib-empty { margin: 0; padding: 48px 0 8px; color: var(--lib-mute); font-size: 1.1rem; text-align: center; }
.lib-empty::before { content: '◆'; display: block; margin-bottom: 14px; color: var(--lib-accent); font-size: 0.9rem; }
.lib-empty--note { padding-top: 6px; font-size: 0.92rem; }
.lib-empty--note::before { content: none; }
.lib-note { margin: 28px 0 0; color: var(--lib-faint); font-size: 0.9rem; text-align: center; }

/* ═══ الشبكةُ المبرَّرة ═══ */
.lib-grid {
    --h: 300px; --gap: 16px;
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--gap);
}
.lib-grid::after { content: ''; flex-grow: 1000000; }
.lib-cell {
    position: relative;
    flex-basis: calc(var(--r) * var(--h));
    max-width: calc(var(--r) * var(--h) * 1.7);
    aspect-ratio: var(--r);
    min-width: 0;
    background: var(--lib-surface);
    border-radius: 3px; overflow: hidden;
}
.lib-cell__a { display: block; width: 100%; height: 100%; position: relative; text-decoration: none; }
.lib-cell__a:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: -2px; }
.lib-cell .lib-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lib-cell__cap {
    position: absolute; inset: auto 0 0 0;
    display: flex; flex-direction: column; gap: 2px;
    padding: 36px 14px 12px;
    background: linear-gradient(to top, rgba(14, 11, 9, 0.82), rgba(14, 11, 9, 0));
    opacity: 0; transform: translateY(6px);
    transition: opacity .45s var(--lib-ease), transform .45s var(--lib-ease);
    pointer-events: none;
}
.lib-cell__t { font-size: 0.95rem; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-cell__by { font-size: 0.8rem; color: var(--lib-mute); }
.lib-cell__a:hover .lib-cell__cap, .lib-cell__a:focus-visible .lib-cell__cap { opacity: 1; transform: none; }
@media (hover: none) { .lib-cell__cap { display: none; } }

@media (max-width: 1000px) { .lib-grid { --h: 230px; --gap: 12px; } }
@media (max-width: 640px)  { .lib-grid { --h: 150px; --gap: 6px; } }

/* ═══ المصوّرون ═══ */
.lib-artists { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px;
               grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.lib-artist {
    display: flex; align-items: center; gap: 14px; height: 100%;
    padding: 14px 16px; border-radius: 14px; text-decoration: none;
    background: var(--lib-bg-2); border: 1px solid var(--lib-line);
    transition: border-color .35s, background .35s;
}
.lib-artist:hover, .lib-artist:focus-visible { border-color: rgba(255, 119, 0, 0.45); background: var(--lib-surface); }
.lib-artist__t { display: flex; flex-direction: column; min-width: 0; }
.lib-artist__t strong { font-weight: 600; font-size: 1.02rem; overflow-wrap: anywhere; }
.lib-artist__t small { color: var(--lib-mute); font-size: 0.84rem; }
.lib-av {
    flex: none; display: inline-grid; place-items: center;
    width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
    background: var(--lib-surface); color: var(--lib-accent);
    font-family: var(--lib-serif); font-size: 1.4rem;
    border: 1px solid var(--lib-line);
}
.lib-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-av--lg { width: 104px; height: 104px; font-size: 2.6rem; margin-bottom: 22px; border-width: 2px; }

/* ═══ القصص ═══ */
.lib-stories { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px;
               grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.lib-story { display: flex; flex-direction: column; gap: 14px; text-decoration: none; }
.lib-story__img { display: block; aspect-ratio: 3 / 2; border-radius: 6px; overflow: hidden; background: var(--lib-surface); }
.lib-story__img .lib-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 1.2s var(--lib-ease); }
.lib-story__t { display: flex; flex-direction: column; gap: 4px; }
.lib-story__t strong { font-family: var(--lib-serif); font-weight: 500; font-size: 1.3rem; line-height: 1.4; overflow-wrap: anywhere; }
.lib-story__t small { color: var(--lib-faint); font-size: 0.86rem; }
.lib-story:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 6px; border-radius: 6px; }

/* ═══ رأسُ المصوّر ═══ */
.lib-ahead { position: relative; padding: 140px 0 16px; }
.lib-ahead--cover { padding-top: 0; }
.lib-cover { position: relative; height: clamp(220px, 46vh, 520px); overflow: hidden; }
.lib-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-cover::after { content: ''; position: absolute; inset: 0;
                    background: linear-gradient(to bottom, rgba(21, 17, 14, 0.15) 0%, rgba(21, 17, 14, 0.2) 55%, #15110e 100%); }
.lib-ahead--cover .lib-ahead__in { position: relative; margin-top: -72px; }
.lib-bio { max-width: 680px; margin-top: 22px; color: var(--lib-mute); font-size: 1.05rem; line-height: 2.05; }
.lib-bio p + p { margin-top: 12px; }
.lib-links { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 22px 0 0; }
.lib-links a { color: var(--lib-accent); text-decoration: none; font-size: 0.95rem; }
.lib-links a:hover { text-decoration: underline; }

.lib-foot { padding-top: 24px; }
.lib-copy { margin: 28px 0 10px; color: var(--lib-faint); font-size: 0.86rem; }
.lib-back { color: var(--lib-mute); text-decoration: none; font-size: 0.95rem; }
.lib-back:hover { color: var(--lib-accent); }

/* ═══ القصّة ═══ */
.lib-shead { padding: 150px 0 12px; }
.lib-body { max-width: 680px; margin: 6px 0 22px; color: var(--lib-mute); font-size: 1.1rem; line-height: 2.1; }
.lib-body p + p { margin-top: 14px; }
.lib-seq { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 72px; }
.lib-seq__i { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lib-seq__a { display: block; max-width: 100%; border-radius: 3px; overflow: hidden; background: var(--lib-surface); }
.lib-seq__a .lib-img { display: block; width: auto; height: auto; max-width: 100%; max-height: 88vh; }
.lib-seq__a:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 4px; }
.lib-seq__note { max-width: 640px; margin: 0; color: var(--lib-mute); text-align: center; line-height: 1.9; }
.lib-seq__by { margin: 0; font-size: 0.86rem; }
.lib-seq__by a { color: var(--lib-faint); text-decoration: none; }
.lib-seq__by a:hover { color: var(--lib-accent); }

/* ═══ الصورة ═══ */
.lib--i { padding-top: 92px; }
.lib-preview ~ .lib-fig { margin-top: 24px; }
.lib-fig { margin: 0; padding: 18px 24px 8px; display: flex; justify-content: center; }
/* 🔑 **والاسمُ والعنوانُ في الشاشة الأولى مع الصورة** — بـ`86vh` وحدها كانت الصورةُ تملأ الشاشة والاسمُ تحت الطيّة (قِيس على
      ١٢٨٠×٨٠٠: الاسم عند ٨٤٠) — ولقطةُ الشاشة الأولى صورةٌ بلا صاحبها. ⇒ يُترك لهما ٢٥٠ بكسلاً، وأرضيّةٌ لشاشةٍ قصيرة */
.lib-fig__img { display: block; width: auto; height: auto; max-width: 100%; max-height: max(320px, min(86vh, calc(100vh - 250px))); border-radius: 2px; }
.lib-photo { max-width: 840px; padding-top: 34px; }
.lib-det__by { margin: 0 0 6px; font-size: 1rem; }
.lib-det__by a { color: var(--lib-accent); text-decoration: none; }
.lib-det__by a:hover { text-decoration: underline; }
.lib-det__en { color: var(--lib-faint); font-size: 0.88rem; }
.lib-det__t { font-family: var(--lib-serif); font-weight: 500; line-height: 1.25; margin: 0 0 16px;
              font-size: clamp(1.9rem, 4.8vw, 3rem); overflow-wrap: anywhere; }
.lib-det__cap { margin: 0 0 8px; color: var(--lib-mute); font-size: 1.08rem; line-height: 1.95; }
.lib-det__sec { margin-top: 30px; }
.lib-det__sec h3 { margin: 0 0 12px; font-family: var(--lib-serif); font-weight: 500; font-size: 1.25rem; color: var(--lib-txt); }
.lib-det__sec p { margin: 0 0 12px; color: var(--lib-mute); line-height: 2.05; }
.lib-det__kv { display: grid; gap: 0; margin: 30px 0 0; border-top: 1px solid var(--lib-line); }
.lib-det__kv > div { display: grid; grid-template-columns: 110px 1fr; gap: 6px 18px; padding: 12px 0; border-bottom: 1px solid var(--lib-line); }
.lib-det__kv dt { color: var(--lib-faint); font-size: 0.88rem; }
.lib-det__kv dd { margin: 0; font-size: 0.95rem; overflow-wrap: anywhere; }
.lib-det__st { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.lib-det__st a { display: inline-block; padding: 7px 14px; border-radius: 50px; border: 1px solid var(--lib-line); text-decoration: none; font-size: 0.92rem; }
.lib-det__st a:hover { border-color: rgba(255, 119, 0, 0.5); color: var(--lib-accent); }
.lib-det__page { display: inline-block; margin-top: 8px; color: var(--lib-accent); text-decoration: none; font-size: 0.95rem; }
.lib-det__page:hover { text-decoration: underline; }
.lib-bts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.lib-bts__i { display: block; height: 120px; border-radius: 4px; overflow: hidden; background: var(--lib-surface); }
.lib-bts__i .lib-img { display: block; height: 100%; width: auto; }
.lib-bts__i:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 3px; }

.lib-pn { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
          margin: 40px 0 18px; padding: 16px 0; border-top: 1px solid var(--lib-line); border-bottom: 1px solid var(--lib-line); }
.lib-pn__a { text-decoration: none; color: var(--lib-txt); padding: 8px 2px; }
.lib-pn__a[rel="next"] { justify-self: end; }
.lib-pn__a:hover { color: var(--lib-accent); }
.lib-pn__n { color: var(--lib-faint); font-size: 0.86rem; }

/* ═══ الردع — لا حماية: لا تحديدَ ولا سحبَ ولا قائمةَ لمسٍ مطوّل على الصور ═══ */
.lib-img, .lib-v__img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }

/* ═══ الحركة — بطيئةٌ وتُحترم «تقليل الحركة» ═══ */
@media (prefers-reduced-motion: no-preference) {
    .lib-hero .lib-wrap > *, .lib-ahead__in > *, .lib-shead .lib-wrap > * { animation: lib-rise 1s var(--lib-ease) both; }
    .lib-hero .lib-wrap > :nth-child(2), .lib-ahead__in > :nth-child(3), .lib-shead .lib-wrap > :nth-child(2) { animation-delay: .08s; }
    .lib-hero .lib-wrap > :nth-child(n+3), .lib-ahead__in > :nth-child(n+4), .lib-shead .lib-wrap > :nth-child(n+3) { animation-delay: .16s; }
    .lib-cell .lib-img { transition: transform 1.2s var(--lib-ease); }
    .lib-cell__a:hover .lib-img { transform: scale(1.025); }
    .lib-story:hover .lib-img { transform: scale(1.03); }
    @supports (animation-timeline: view()) {
        .lib-cell, .lib-seq__i, .lib-story, .lib-artist {
            animation: lib-rise linear both;
            animation-timeline: view();
            animation-range: entry 0% entry 38%;
        }
    }
}
@keyframes lib-rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

/* ═══ العارض — بملء الشاشة · الصورةُ والقصّةُ جانباً ═══ */
.lib-v {
    position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
    margin: 0; padding: 0; border: 0;
    background: rgba(13, 10, 8, 0.97); color: #f1e9df;
    --lib-txt: #f1e9df; --lib-mute: rgba(241, 233, 223, 0.64); --lib-faint: rgba(241, 233, 223, 0.42);
    --lib-line: rgba(255, 240, 225, 0.09); --lib-surface: #241e1a; --lib-accent: var(--vmp-orange-light, #ff7700);
    --lib-serif: var(--jf-d, 'Thmanyah Serif Display', 'Thmanyah Sans', Georgia, serif);
    overscroll-behavior: contain;
}
.lib-v::backdrop { background: rgba(0, 0, 0, 0.7); }
/* الصفحةُ تحت العارض لا تتمرّر — `showModal` يحجب النقرَ لا العجلةَ ولا السحبَ على الجوال */
html.lib-v-on { overflow: hidden; }
.lib-v[open] { display: grid; grid-template-columns: minmax(0, 1fr) 400px; }
.lib-v.is-noside[open] { grid-template-columns: minmax(0, 1fr); }
.lib-v__stage { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; overflow: hidden; touch-action: pan-y; }
.lib-v__img { display: block; max-width: calc(100% - 120px); max-height: calc(100% - 64px); width: auto; height: auto; object-fit: contain;
              opacity: 1; transition: opacity .35s var(--lib-ease); }
.lib-v__img.is-loading { opacity: 0.25; }
.lib-v__side { overflow-y: auto; padding: 72px 30px 40px; border-inline-start: 1px solid var(--lib-line); background: rgba(21, 17, 14, 0.92); }
.lib-v.is-noside .lib-v__side, .lib-v.is-noside .lib-v__more { display: none; }
.lib-v__side .lib-det__t { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.lib-v__side .lib-det__kv > div { grid-template-columns: 84px 1fr; }
.lib-v__msg { color: var(--lib-mute); font-size: 0.95rem; line-height: 1.9; }
.lib-v__msg a { color: var(--lib-accent); }
.lib-v__cap { position: absolute; inset: auto 0 18px 0; text-align: center; color: var(--lib-mute); font-size: 0.9rem; padding: 0 70px; }

.lib-v__btn {
    position: absolute; z-index: 3; display: inline-grid; place-items: center;
    width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
    border: 1px solid rgba(255, 240, 225, 0.16); background: rgba(21, 17, 14, 0.6); color: #f1e9df;
    font-size: 1.5rem; line-height: 1; transition: border-color .3s, background .3s, opacity .3s;
    -webkit-tap-highlight-color: transparent;
}
.lib-v__btn:hover, .lib-v__btn:focus-visible { border-color: var(--lib-accent); background: rgba(36, 30, 26, 0.9); }
.lib-v__btn:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 2px; }
.lib-v__btn[disabled] { opacity: 0; pointer-events: none; }
.lib-v__x { top: 16px; inset-inline-end: 16px; position: fixed; font-size: 1.2rem; }
.lib-v__prev { inset-inline-start: 18px; top: 50%; transform: translateY(-50%); }
.lib-v__next { inset-inline-end: 18px; top: 50%; transform: translateY(-50%); }
.lib-v__n { position: absolute; top: 24px; inset-inline-start: 24px; color: var(--lib-faint); font-size: 0.86rem; z-index: 2; }
.lib-v__more { display: none; }
.lib-v__sh { display: none; }   /* رأسُ ورقة الجوال — على الحاسب الجانبُ ظاهرٌ دائماً فلا يُطوى */

@media (max-width: 900px) {
    .lib-v[open] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
    .lib-v__img { max-width: calc(100% - 24px); max-height: calc(100% - 140px); }
    .lib-v__prev, .lib-v__next { top: auto; bottom: 22px; transform: none; width: 44px; height: 44px; }
    .lib-v__more {
        display: inline-flex; position: absolute; z-index: 3; bottom: 22px; left: 50%; transform: translateX(-50%);
        align-items: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 50px; cursor: pointer;
        border: 1px solid rgba(255, 240, 225, 0.18); background: rgba(21, 17, 14, 0.75); color: #f1e9df;
        font: inherit; font-size: 0.92rem; white-space: nowrap;
    }
    .lib-v__side {
        position: fixed; inset: auto 0 0 0; z-index: 4; max-height: 74vh;
        padding: 26px 22px 34px; border-inline-start: 0; border-top: 1px solid var(--lib-line);
        border-radius: 18px 18px 0 0; background: #1c1714;
        transform: translateY(102%); transition: transform .45s var(--lib-ease);
        visibility: hidden;
    }
    .lib-v.is-sheet .lib-v__side { transform: none; visibility: visible; }
    /* ⚠️ **الورقةُ تغطّي زرَّها** — فلها رأسٌ لاصقٌ يطويها (والنقرُ على الصورة فوقها وEscape يطويانها أيضاً) */
    .lib-v__side { padding-top: 0; }
    .lib-v__sh {
        display: flex; justify-content: center; position: sticky; top: 0; z-index: 1;
        margin: 0 -22px 14px; padding: 10px 22px; background: #1c1714; border-bottom: 1px solid var(--lib-line);
    }
    .lib-v__sh::before { content: ''; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px;
                         border-radius: 4px; background: rgba(255, 240, 225, 0.22); }
    .lib-v__hide {
        min-height: 44px; padding: 8px 18px 0; border: 0; background: none; color: var(--lib-mute);
        font: inherit; font-size: 0.9rem; cursor: pointer;
    }
    .lib-v__hide:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 2px; border-radius: 8px; }
    .lib-v__x { top: 12px; inset-inline-end: 12px; }
    .lib-v__n { top: 22px; inset-inline-start: 18px; }
}
@media (prefers-reduced-motion: reduce) {
    .lib-v__img, .lib-v__side { transition: none; }
}

/* ═══ ▧ ب-٨ — «مصوّرٌ؟ اعرض أعمالك هنا»: بابُ الانضمام إلى البوّابة — هادئٌ في آخر الصفحة لا لافتةٌ فوق الأعمال ═══ */
.lib-join__s { max-width: 640px; margin: 0 0 18px; color: var(--lib-mute); line-height: 2; font-size: 1rem; }
.lib-join__p { margin: 0; }
.lib-join__a {
    display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px; border-radius: 999px;
    border: 1px solid var(--lib-accent); color: var(--lib-txt) !important; text-decoration: none; font-weight: 600;
    background: rgba(255, 119, 0, 0.10); transition: background .25s var(--lib-ease);
}
.lib-join__a:hover { background: rgba(255, 119, 0, 0.22); }
.lib-join__a:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 3px; }

/* ═══ الجوال ═══ */
@media (max-width: 640px) {
    .lib-wrap { padding: 0 16px; }
    .lib-hero { padding: 118px 0 18px; }
    .lib-shead { padding-top: 118px; }
    .lib-ahead { padding-top: 112px; }
    .lib-ahead--cover { padding-top: 0; }
    .lib-cover { height: 240px; }
    .lib-ahead--cover .lib-ahead__in { margin-top: -56px; }
    .lib-av--lg { width: 84px; height: 84px; font-size: 2.1rem; }
    .lib-sec { padding: 36px 0 !important; }   /* بعد كتلة ٧٦٨ أعلاه — ومثلُها `!important` (حشوةُ `site.css` للوسم) */
    .lib-h { margin-bottom: 18px; }
    .lib-fig { padding: 10px 0 0; }
    .lib-fig__img { max-height: 78vh; border-radius: 0; }
    .lib-seq { gap: 44px; }
    .lib-det__kv > div { grid-template-columns: 86px 1fr; }
    .lib-artists { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════════════
 * ▧ م-٣ — «تشبه إنستغرام ومعارض أعمالٍ فاخرة» (طلبُ سعود ١٣ أكتوبر · النموذجُ المعتمد)
 *   حلقاتُ المصوّرين · تبويباتٌ · رقاقاتُ التصنيف · قصّةٌ مختارة · احفظ · تابِع · شارك · الكواليس · محفوظاتي
 * 🔑 **ما لا يعمل بلا سكربتٍ لا يُرسم بلا سكربت** — الأزرارُ والتبويباتُ والرقاقاتُ مخفيّةٌ حتى يُعلن `library.js` نفسَه
 *    (`.lib-js` على `<html>`)؛ وبلاه المعرضُ كاملٌ متتالٍ بعناوينه. وزرٌّ ظاهرٌ لا يفعل شيئاً يُقرأ عطلاً.
 * ⚠️ **والألوانُ على البرتقاليّ داكنةٌ** (`#15110e` — تباينٌ ≈ ٧٫٥) لا بيضاء (≈ ٢٫٨): زرُّ «تابِع» يُقرأ.
 * ════════════════════════════════════════════════════════════════════ */

/* الرأسُ أهدأ — العنوانُ وزرُّ «محفوظاتي» في سطرٍ، والأعمالُ أقربُ إلى الشاشة الأولى */
.lib-hero { padding: 132px 0 18px; }
.lib-hero .lib-title { font-size: clamp(2.3rem, 6.4vw, 4.4rem); margin-bottom: 14px; }
.lib-hero .lib-lead { margin-bottom: 12px; }
.lib-hero__in { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.lib-hero__t { min-width: 0; flex: 1 1 420px; }
.lib-pill {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px;
    border: 1px solid rgba(255, 240, 225, 0.16); background: var(--lib-surface); color: var(--lib-txt);
    text-decoration: none; font-size: 0.95rem; transition: border-color .3s var(--lib-ease);
}
.lib-pill svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.lib-pill:hover, .lib-pill:focus-visible { border-color: var(--lib-accent); }
.lib-pill:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 3px; }

/* ═══ حلقاتُ المصوّرين — شريطٌ أفقيٌّ يُمرَّر داخلَه لا بالصفحة ═══ */
.lib-rings { padding: 10px 0 8px; }
.lib-rings .lib-h { font-size: 1.25rem; margin-bottom: 14px; }
.lib-rings__l {
    list-style: none; margin: 0; padding: 6px 2px 12px; display: flex; gap: 18px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none;
}
.lib-rings__l::-webkit-scrollbar { display: none; }
.lib-rings__l > li { flex: none; scroll-snap-align: start; }
.lib-ring { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 78px; text-decoration: none; color: var(--lib-txt); }
.lib-ring__av {
    display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; overflow: hidden;
    background: var(--lib-surface); color: var(--lib-accent); font-family: var(--lib-serif); font-size: 1.6rem;
    border: 3px solid var(--lib-bg); box-shadow: 0 0 0 2px rgba(255, 240, 225, 0.18);
    transition: box-shadow .35s var(--lib-ease), transform .35s var(--lib-ease);
}
.lib-ring__av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-ring--new .lib-ring__av { box-shadow: 0 0 0 2.5px var(--lib-accent), 0 0 18px rgba(255, 119, 0, 0.28); }
.lib-ring__n { font-size: 0.82rem; max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--lib-mute); }
.lib-ring:hover .lib-ring__av, .lib-ring:focus-visible .lib-ring__av { transform: translateY(-2px); box-shadow: 0 0 0 2.5px var(--lib-accent); }
.lib-ring:focus-visible { outline: none; }
.lib-ring:focus-visible .lib-ring__n { color: var(--lib-txt); text-decoration: underline; }

/* ═══ التبويبات — ملتصقةٌ أعلى الصفحة وهي تُمرَّر ═══ */
.lib-tabsbar { position: sticky; top: 0; z-index: 20; padding: 10px 0; background: rgba(21, 17, 14, 0.92);
               -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--lib-line); }
.lib-tabs { display: flex; gap: 4px; max-width: 520px; margin: 0 auto; padding: 4px; border-radius: 14px; background: var(--lib-surface); }
.lib-tab {
    flex: 1; min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--lib-mute);
    font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: background .3s var(--lib-ease), color .3s;
}
.lib-tab[aria-selected="true"] { background: var(--lib-txt); color: var(--lib-bg); }
.lib-tab:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 2px; }
/* مع التبويبات: عنوانُ القسم لقارئ الشاشة وحده (التبويبُ يسمّيه) — والقسمُ يبدأ قريباً من الشريط */
.lib-tabs-on .lib-panel > .lib-wrap > .lib-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lib-tabs-on .lib-panel { padding-top: 24px !important; }
.lib-panel[hidden] { display: none !important; }

/* ═══ رقاقاتُ التصنيف ═══ */
.lib-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 0 22px; padding: 2px 2px 6px; }
.lib-chips::-webkit-scrollbar { display: none; }
.lib-chip {
    flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
    border: 1px solid rgba(255, 240, 225, 0.16); background: transparent; color: var(--lib-mute); font: inherit; font-size: 0.92rem;
    transition: border-color .3s, background .3s, color .3s;
}
.lib-chip small { color: var(--lib-faint); font-size: 0.78rem; margin-inline-start: 2px; }
.lib-chip[aria-pressed="true"] { border-color: var(--lib-accent); background: rgba(255, 119, 0, 0.14); color: #ffd9b0; }
.lib-chip:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 2px; }
.lib-cell[hidden] { display: none; }
.lib-note--start { text-align: start; margin: -8px 0 22px; }

/* ═══ القصّةُ المختارة ═══ */
.lib-feature {
    position: relative; display: block; margin: 0 0 30px; border-radius: 22px; overflow: hidden;
    aspect-ratio: 16 / 7; background: var(--lib-surface); text-decoration: none; color: var(--lib-txt);
}
.lib-feature .lib-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--lib-ease); }
.lib-feature::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(14, 11, 9, 0.9) 0%, rgba(14, 11, 9, 0.15) 55%, rgba(14, 11, 9, 0) 100%); }
.lib-feature__t { position: absolute; z-index: 1; inset: auto 26px 22px 26px; display: flex; flex-direction: column; gap: 6px; }
.lib-feature__k { align-self: flex-start; padding: 5px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
                  color: #ffcf9e; background: rgba(21, 17, 14, 0.6); border: 1px solid rgba(255, 154, 61, 0.4); }
.lib-feature__t strong { font-family: var(--lib-serif); font-weight: 500; font-size: clamp(1.6rem, 3.6vw, 2.6rem); line-height: 1.25; overflow-wrap: anywhere; }
.lib-feature__t small { color: rgba(241, 233, 223, 0.8); font-size: 0.9rem; }
.lib-feature:hover .lib-img { transform: scale(1.03); }
.lib-feature:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 4px; }

/* ═══ احفظ · شارك · تابِع — بعد السكربت وحده ═══ */
.lib-save, .lib-share, .lib-follow { display: none; }
.lib-js .lib-save, .lib-js .lib-share, .lib-js .lib-follow { display: inline-flex; }
.lib-save {
    position: absolute; z-index: 2; top: 10px; inset-inline-end: 10px; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; color: var(--lib-txt);
    background: rgba(21, 17, 14, 0.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    transition: opacity .3s var(--lib-ease), transform .25s var(--lib-ease), color .25s;
}
.lib-save svg, .lib-share svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lib-save[aria-pressed="true"] { color: var(--lib-accent); }
.lib-save[aria-pressed="true"] svg { fill: currentColor; }
.lib-save:active { transform: scale(0.9); }
.lib-save:focus-visible, .lib-share:focus-visible, .lib-follow:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 2px; }
@media (hover: hover) {
    .lib-cell .lib-save { opacity: 0; }
    .lib-cell:hover .lib-save, .lib-cell:focus-within .lib-save, .lib-cell .lib-save[aria-pressed="true"] { opacity: 1; }
}
@media (hover: none) { .lib-save { width: 44px; height: 44px; } }
.lib-save.is-pop svg { animation: lib-pop .45s var(--lib-ease); }
@keyframes lib-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* في التفاصيل: زرّان بنصٍّ ظاهر */
.lib-det__act { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.lib-save--txt, .lib-share {
    position: static; width: auto; height: auto; min-height: 44px; padding: 0 16px; gap: 8px; border-radius: 999px;
    align-items: center; border: 1px solid rgba(255, 240, 225, 0.16); background: var(--lib-surface); color: var(--lib-txt);
    font: inherit; font-size: 0.92rem; cursor: pointer; opacity: 1 !important;
}
.lib-save--txt[aria-pressed="true"] { border-color: var(--lib-accent); color: #ffd9b0; }
.lib-share:hover, .lib-save--txt:hover { border-color: rgba(255, 119, 0, 0.55); }

/* ═══ ملفُّ المصوّر — أرقامٌ وأفعال ═══ */
.lib-stats { list-style: none; display: flex; gap: clamp(22px, 5vw, 44px); margin: 18px 0 0; padding: 14px 0; max-width: 560px;
             border-top: 1px solid var(--lib-line); border-bottom: 1px solid var(--lib-line); }
.lib-stats li { display: flex; flex-direction: column; gap: 2px; }
.lib-stats b { font-family: var(--lib-serif); font-weight: 500; font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.lib-stats span { color: var(--lib-faint); font-size: 0.82rem; }
.lib-acts { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; }
.lib-follow {
    align-items: center; justify-content: center; min-height: 46px; min-width: 120px; padding: 0 26px; border-radius: 12px;
    border: 1px solid transparent; background: var(--lib-accent); color: #15110e; font: inherit; font-weight: 600; font-size: 0.98rem;
    cursor: pointer; transition: background .3s var(--lib-ease), color .3s, border-color .3s;
}
.lib-follow[aria-pressed="true"] { background: var(--lib-surface); color: var(--lib-txt); border-color: rgba(255, 240, 225, 0.18); }
.lib-ask {
    display: inline-flex; align-items: center; min-height: 46px; padding: 0 22px; border-radius: 12px; text-decoration: none;
    border: 1px solid rgba(255, 240, 225, 0.2); color: var(--lib-txt) !important; font-weight: 600; font-size: 0.95rem;
    transition: border-color .3s;
}
.lib-ask:hover, .lib-ask:focus-visible { border-color: var(--lib-accent); }
.lib-ask:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 2px; }
.lib-acts .lib-share { min-height: 46px; border-radius: 12px; }

/* الكواليس — شبكةٌ مبرَّرةٌ أصغر ووسمُ «من …» يقود إلى الأصل */
.lib-grid--bts { --h: 220px; }
.lib-bts__of {
    position: absolute; z-index: 2; inset: auto 8px 8px auto; max-width: calc(100% - 16px); padding: 5px 11px; border-radius: 999px;
    background: rgba(21, 17, 14, 0.72); color: var(--lib-mute); font-size: 0.78rem; text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lib-bts__of:hover, .lib-bts__of:focus-visible { color: var(--lib-txt); }

/* بطاقةُ الانضمام و«ادخل» في محفوظاتي */
.lib-join__card { padding: clamp(22px, 4vw, 34px); border-radius: 22px; background: var(--lib-bg-2); border: 1px solid var(--lib-line); }
.lib-join__card .lib-h::after { content: none; }

/* رسالةٌ عائمة — «حُفظ» · «نُسخ الرابط» · «ادخل لتحفظ» */
.lib-toast {
    position: fixed; z-index: 1100; bottom: 22px; left: 50%; transform: translate(-50%, 20px); opacity: 0;
    max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px; background: #241e1a; color: #f1e9df;
    border: 1px solid rgba(255, 240, 225, 0.14); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); font-size: 0.95rem; line-height: 1.7;
    transition: opacity .3s var(--lib-ease), transform .3s var(--lib-ease); pointer-events: none;
}
.lib-toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.lib-toast a { color: #ff9a3d; font-weight: 600; margin-inline-start: 6px; }

@media (max-width: 640px) {
    .lib-hero { padding: 108px 0 6px; }
    .lib-rings__l { gap: 14px; }
    .lib-ring { width: 70px; }
    .lib-ring__av { width: 62px; height: 62px; }
    .lib-tabsbar { padding: 8px 0; }
    .lib-feature { aspect-ratio: 4 / 5; border-radius: 18px; }
    .lib-feature__t { inset: auto 18px 18px 18px; }
    .lib-stats { gap: 26px; }
    .lib-follow, .lib-ask { flex: 1 1 auto; justify-content: center; }
    .lib-grid--bts { --h: 150px; }
}
@media (prefers-reduced-motion: reduce) {
    .lib-feature .lib-img, .lib-ring__av, .lib-toast, .lib-save { transition: none; }
    .lib-save.is-pop svg { animation: none; }
}
