/* المتغيرات العامة للألوان */
:root {
    --bg-dark: #050505;
    --gold-vintage: #b8860b;
    --text-creamy: #e0d7c6;
    --glass-smoke: rgba(26, 26, 26, 0.5);
    --glass-border: rgba(184, 134, 11, 0.25);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    background: var(--bg-dark); 
    overflow-y: auto; /* تغيير من hidden إلى auto */
    overflow-x: hidden; 
    font-family: 'Cairo', sans-serif; 
    color: var(--text-creamy); 
}
a{
    text-decoration: none;
    color: var(--text-creamy);
}
ul{
    list-style: none;
}
/* طبقة الدخول */
/* إصلاح تجاوب بوابة الدخول للجوال */
#intro-layer {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999;
}

#library-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* لضمان ملء الصورة للشاشة دون تشويه */
    position: absolute;
}

#enter-btn {
    position: relative;
    z-index: 10;
    padding: 10px 49px;
    font-size: 1.2rem;
    background-color: var(--gold-vintage);
    border: navajowhite;
    border-radius: 20px;
    color: var(--text-creamy);
    font-size: 26px;
}

/* التنسيق الرئيسي المتجاوب */
#main-site { 
    opacity: 0; 
    visibility: hidden; 
    min-height: 100vh; /* تغيير من height إلى min-height */
    width: 100vw;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    position: relative;
}

/* العنوان */
/* --- تعديلات الـ Hero Section --- */

.hero-header {
    margin-top: 10vh;
    text-align: center;
    z-index: 10;
    position: relative;
}

.main-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 8vw, 5rem); /* حجم مرن وكبير */
    color: var(--gold-vintage);
    text-shadow: 0 0 30px rgba(184, 134, 11, 0.4);
    letter-spacing: 5px;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero-subtitle {
    font-family: 'Cairo', sans-serif;
    font-size: 1.4rem;
    color: var(--text-creamy);
    opacity: 0.9;
    letter-spacing: 4px;
    font-weight: 300;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
}

/* إضافة خطوط ذهبية رفيعة بجانب العنوان الفرعي */
.hero-subtitle::before, .hero-subtitle::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 50px;
    height: 1px;
    background: var(--gold-vintage);
    opacity: 0.5;
}
.hero-subtitle::before { right: -70px; }
.hero-subtitle::after { left: -70px; }


.serif-text {
    font-size: 3rem;
    letter-spacing: 2px;
}
/* حاوية البحث - مخفية في الأعلى */
.search-overlay {
    position: fixed;
    top: -120px; /* البداية خارج الشاشة من الأعلى */
    left: 0;
    width: 100%;
    height: 100px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(25px);
    border-bottom: 1px solid var(--gold-vintage);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    opacity: 0;
    pointer-events: none;
}

/* عندما تصبح نشطة */
.search-overlay.active {
    top: 0;
    opacity: 1;
    pointer-events: all;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.search-inner {
    width: 90%;
    max-width: 800px;
}

.search-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-main-icon { font-size: 1.5rem; color: var(--gold-vintage); }

#mainSearch {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(184, 134, 11, 0.2);
    color: #fff;
    font-size: 1.2rem;
    padding: 10px;
    outline: none;
    font-family: 'Cairo', sans-serif;
    transition: border-color 0.3s;
}

#mainSearch:focus {
    border-color: var(--gold-vintage);
}

.close-search {
    background: transparent;
    border: none;
    color: var(--text-creamy);
    font-size: 1.5rem;
    cursor: pointer;
    transition: 0.3s;
}

.close-search:hover { color: var(--gold-vintage); transform: scale(1.1); }


/* --- تطوير شريط التنقل --- */
.nav-container {
    width: 100%;
    display: flex;
    justify-content: center;
    position: sticky;
    top: 25px;
    z-index: 1000;
}

.nav-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(15, 15, 15, 0.75); /* زجاج داكن */
    backdrop-filter: blur(20px) saturate(160%);
    padding: 6px 10px;
    border-radius: 100px; /* شكل الكبسولة */
    border: 1px solid rgba(184, 134, 11, 0.3);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 
                inset 0 0 20px rgba(184, 134, 11, 0.1);
}

.nav-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 25px;
    cursor: pointer;
    z-index: 2;
    transition: all 0.4s ease;
    color: #e0d7c6;
    font-weight: 600;
}

.nav-icon { font-size: 1.2rem; }

/* المؤشر الذهبي المضيء */
.nav-indicator {
    position: absolute;
    height: calc(100% - 12px);
    background: linear-gradient(135deg, #b8860b, #8b6508);
    border-radius: 100px;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(184, 134, 11, 0.5);
    pointer-events: none; /* لكي لا يعيق الضغط على الأزرار */
}

/* حالة الزر النشط */
.nav-card.active {
    color: #000; /* النص يصبح أسود فوق الذهبي */
}

/* تأثير عند التمرير بالماوس لغير النشط */
.nav-card:not(.active):hover {
    color: #fff;
    transform: translateY(-2px);
}

/* --- إعدادات الشاشات الصغيرة (الجوال) --- */
@media (max-width: 768px) {
    /* تصغير حجم المنيو ليناسب عرض الجوال */
    .nav-wrapper {
        padding: 4px 8px;
        width: 95%;
        justify-content: space-around;
    }

    .nav-card {
        padding: 8px 12px;
        gap: 5px;
    }

    /* إخفاء النص في الجوال والاكتفاء بالأيقونات لتوفير مساحة */
    .nav-text {
        display: none;
    }

    .nav-icon {
        font-size: 1.4rem; /* تكبير الأيقونة قليلاً لتسهيل الضغط */
    }

    /* تعديل مربع البحث المنبثق للجوال */
    .search-overlay {
        height: 80px;
    }

    #mainSearch {
        font-size: 1rem;
    }

    /* تعديل عنوان الموقع الرئيسي */
    .main-title {
        font-size: 2rem !important;
    }
}

/* --- إعدادات الشاشات المتناهية الصغر --- */
@media (max-width: 480px) {
    .nav-container {
        top: 10px; /* تقريب المنيو من الأعلى */
    }
    
    .nav-card {
        padding: 10px;
    }
}
/* --- المسرح الرئيسي المطور --- */
.display-stage {
    position: absolute;
    width: 100%;
    height: 100vh;
    background: #000;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* حاوية الكاروسيل */
.manuscript-carousel-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

/* الصورة الأساسية: سر التفاصيل */
.carousel-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    /* contain يضمن ظهور المخطوطة كاملة بدون قص، 
       بينما التدرج في الخلفية يملأ الفراغات */
    object-fit: contain; 
    opacity: 0;
    transition: opacity 1.5s ease-in-out, transform 8s ease-out;
    z-index: 2;
    /* فلتر لزيادة حدة التفاصيل والروح */
    filter: drop-shadow(0 0 50px rgba(0,0,0,0.9)) contrast(1.1);
}

.carousel-img.active {
    opacity: 1;
    transform: scale(1.05); /* حركة زووم خفيفة جداً للروح */
}

/* الطبقة السحرية: خلفية ضبابية تعطي شعور ملء الشاشة دون تشويه */
.manuscript-carousel-bg::before {
    content: '';
    position: absolute;
    inset: -20px;
    background-image: var(--bg-current); /* سيتم تحديثه بالجافا سكريبت */
    background-size: cover;
    background-position: center;
    filter: blur(40px) brightness(0.2); /* تعتيم وضبابية */
    z-index: 1;
}

/* طبقة الروح (الجسيمات الذهبية) */
.particles-container {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

/* محتوى النص فوق كل شيء */
.main-portal-content {
    position: relative;
    z-index: 10;
    text-shadow: 0 5px 15px rgba(0,0,0,1);
}
/* --- التأكد من التجاوب --- */
.main-portal-content {
    width: clamp(300px, 90vw, 800px); /* عرض مرن للمحتوى */
}

.mystic-title {
    font-size: clamp(2.5rem, 9vw, 5.5rem); /* حجم خط مرن */
}

.glowing-subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.3rem); /* حجم خط مرن */
}

.royal-btn-v2 {
    padding: clamp(12px, 3vw, 18px) clamp(30px, 8vw, 45px);
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    border-radius: 15px;
    border: none;
    background-color: var(--gold-vintage);
    color: white;
    cursor: pointer;
}
.portal-text-wrapper{
    
    position: absolute;
    z-index: 99;
    top: 40%;
    width: 100%;
    border: 3px solid var(--gold-vintage);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border-radius: 15px;
    background-color: #eeeeee29;
    margin-top: 50px;
}

/* تنسيق قسم الكتب */
.books-section {
    position: relative; /* تأكد أنه ليس absolute */
    width: 100%;
    padding: 100px 0;
    background: #050505;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gold-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--gold-vintage);
    margin-bottom: 10px;
}

.title-underline {
    width: 80px;
    height: 2px;
    background: var(--gold-vintage);
    margin: 0 auto 50px;
    box-shadow: 0 0 10px var(--gold-vintage);
}

/* حاوية الكتب - Grid متجاوب */
.books-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    width: 100%;
    max-width: 1200px;
    perspective: 1500px; /* لزيادة عمق الـ 3D */
}

/* الكارد الـ 3D */
.book-card-3d {
    height: 400px;
    cursor: pointer;
    perspective: 1000px;
}

.book-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform-style: preserve-3d;
}

.book-card-3d:hover .book-inner {
    transform: rotateY(180deg);
}

.book-front, .book-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

/* الوجه الأمامي (الغلاف) */
.book-front {
    background: #111;
}

.book-front img {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

/* الوجه الخلفي (التفاصيل الزجاجية) */
.book-back {
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(15px);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    text-align: center;
}
/* تنسيق النجوم */
.stars-rating {
    color: #ffbd2e; /* لون ذهبي */
    font-size: 1.2rem;
    cursor: pointer;
    margin-bottom: 10px;
}

.stars-rating i:hover {
    transform: scale(1.2);
}

/* حاوية الأزرار لتكون بجانب بعضها */
.button-group {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

/* الحفاظ على ستايل زر القراءة الخاص بك */
.read-more {
    padding: 8px 15px;
    background: #b8860b;
    color: #000;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    flex: 2; /* جعل زر القراءة أكبر */
}
.read-more:hover {
    background: var(--gold-vintage);
    color: #000;
}
/* تنسيق زر التحميل الجديد */
.download-btn {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #b8860b;
    color: #b8860b;
    border-radius: 4px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    flex: 1;
}

.download-btn:hover {
    background: #b8860b;
    color: #000;
}
.book-back h3 { color: var(--gold-vintage); margin-bottom: 15px; }
.book-back p { font-size: 0.9rem; line-height: 1.6; opacity: 0.8; }





/* التجاوب للموبايل */
@media (max-width: 768px) {
    .books-container { grid-template-columns: 1fr; padding: 0 20px; }
    .book-card-3d { height: 350px; }
}

/* --- إعدادات التجاوب والروح للقسم --- */
.authors-section {
    padding: clamp(50px, 8vw, 100px) 5%;
    background: #050505;
}

.section-header { text-align: center; margin-bottom: 50px; }

/* نصوص مرنة (Responsive Typography) */
.gold-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #b8860b;
    margin-bottom: 15px;
}

/* الشبكة المتجاوبة - هي الأهم هنا */
.authors-grid {
    display: grid;
    /* التكرار التلقائي: يوزع الكروت بحد أدنى 300px للواحد */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.author-card-v2 {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(184, 134, 11, 0.2);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    transition: 0.4s ease;
    backdrop-filter: blur(10px);
}

.author-card-v2:hover {
    transform: translateY(-10px);
    border-color: #ffbd2e;
    background: rgba(184, 134, 11, 0.05);
}

.author-frame {
    width: 120px; height: 120px;
    margin: 0 auto 20px;
    border: 2px solid #b8860b;
    border-radius: 50%;
    padding: 5px;
}

.author-frame img {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.author-content h3 { color: #fff; margin-bottom: 5px; }
.author-content .tag { color: #b8860b; font-size: 0.85rem; }
.author-content .quote { 
    font-style: italic; color: #aaa; 
    margin: 20px 0; font-size: 0.9rem;
    min-height: 45px; 
}
/* تأثير البوابة عند التحميل */
.portal-jump {
    transform: translateZ(1000px) rotateY(-180deg) scale(5) !important;
    opacity: 0;
    transition: transform 1.2s cubic-bezier(0.7, 0, 0.3, 1), opacity 0.8s !important;
    z-index: 9999;
}

/* إضافة لمعة برق خفيفة عند الضغط */
@keyframes flash-white {
    0% { background: transparent; }
    50% { background: #fff; }
    100% { background: transparent; }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #b8860b;
    font-family: 'Amiri', serif;
}

.stats {
    display: flex; justify-content: space-around;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
}

.stat-item b { display: block; color: #ffbd2e; font-size: 1.2rem; }
.stat-item span { color: #777; font-size: 0.75rem; }

/* --- Media Queries للحالات الخاصة --- */
@media (max-width: 480px) {
    .author-card-v2 { padding: 20px; }
    .gold-title { font-size: 1.8rem; }
}


.royal-footer {
    position: relative;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(184, 134, 11, 0.2);
    padding-top: 60px;
    margin-top: 100px;
    color: #fff;
    overflow: hidden;
}

/* تأثير التدرج العلوي */
.footer-divider {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-vintage, #b8860b), transparent);
    box-shadow: 0 0 15px var(--gold-vintage, #b8860b);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    /* نظام التوزيع المتجاوب */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    padding: 0 5%;
}

.footer-column h3 {
    color: var(--gold-vintage, #b8860b);
    margin-bottom: 25px;
    font-size: 1.4rem;
    position: relative;
}

/* عمود "من نحن" */
.footer-logo { font-size: 1.8rem; margin-bottom: 15px; }
.gold-text { color: var(--gold-vintage, #b8860b); }
.about-text { line-height: 1.8; color: #ccc; font-size: 0.95rem; }

.trust-badge {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gold-vintage, #b8860b);
    font-size: 0.85rem;
}

/* الروابط والتواصل */
.footer-column ul { list-style: none; padding: 0; }
.footer-column ul li { margin-bottom: 12px; }
.footer-column ul li a {
    color: #bbb;
    text-decoration: none;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-column ul li a:hover { color: var(--gold-vintage, #b8860b); transform: translateX(-5px); }

.contact-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    color: #ccc;
}

.contact-item i { color: var(--gold-vintage, #b8860b); }

/* أيقونات السوشيال ميديا */
.social-links {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.social-icon {
    width: 40px; height: 40px;
    border: 1px solid rgba(184, 134, 11, 0.3);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    text-decoration: none;
    transition: 0.4s;
}

.social-icon:hover {
    background: var(--gold-vintage, #b8860b);
    color: #000;
    box-shadow: 0 0 15px var(--gold-vintage, #b8860b);
    transform: translateY(-5px);
}

/* الجزء السفلي */
.footer-bottom {
    margin-top: 60px;
    padding: 30px 5%;
    background: rgba(0, 0, 0, 0.5);
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.copyright-content p { font-size: 0.85rem; color: #777; margin: 5px 0; }
.disclaimer { font-size: 0.75rem !important; font-style: italic; }

/* التجاوب للهواتف */
@media (max-width: 768px) {
    .footer-content { text-align: center; }
    .footer-column ul li a { justify-content: center; }
    .contact-item { justify-content: center; }
    .social-links { justify-content: center; }
}

.main-support-btn {
    position: relative;
    overflow: hidden;
    background: #b8860b;
    /* ... بقية التنسيقات السابقة ... */
}

/* تأثير اللمعان المتحرك */
.main-support-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20%;
    height: 200%;
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(30deg);
    transition: none;
    animation: shine-btn 3s infinite;
}

@keyframes shine-btn {
    0% { left: -60%; }
    20% { left: 120%; }
    100% { left: 120%; }
}
@media screen and (max-width: 768px) {
    .modal-content {
        width: 90% !important;
        padding: 20px !important;
        margin: 10px;
    }
    
    .modal-overlay {
        background: rgba(0, 0, 0, 0.95) !important; /* خلفية أغمق للجوال */
    }

    /* منع تداخل أنيميشن الكتاب مع النافذة */
    .portal-jump {
        pointer-events: none; 
    }
}