/* =================== Variables =================== */
:root {
  --bg: #0a0a0a;
  --paper: #fbf6ea;
  --ink: #261d11;
  --gold: #d4af37;
  --gold-deep: #b98c1d;
  --royal: #7d3cff;
  --muted: #8b7a63;
}

/* =================== Base =================== */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }

body {
  background-color: #000;
  background-image: url("https://transparenttextures.com/patterns/black-orchid.png");
  background-attachment: fixed;
  background-size: auto;
  color: #eaeaea;
  font-family: 'Montserrat', sans-serif;
  margin: 0;
  padding: 0;
}

img { max-width: 100%; display: block; }

/* =================== Preloader =================== */
#preloader {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #090909, #0d0d0f);
}
.preload-wrap { display: grid; place-items: center; gap: 18px; }
.preload-book {
  width: 240px; height: 160px; position: relative; perspective: 1200px;
  filter: drop-shadow(0 18px 38px rgba(0,0,0,.6));
}
.preload-book .cover {
  position: absolute; top: 0; width: 120px; height: 100%;
  background: linear-gradient(135deg,#171717,#0e0e0e);
  border: 2px solid #232323; border-radius: 8px;
}
.preload-book .cover.left { left:0; transform-origin: right center; }
.preload-book .cover.right { right:0; transform-origin: left center; box-shadow: inset 0 0 0 2px rgba(212,175,55,.25); }
.preload-book .sheets { position: absolute; left: 120px; top: 8px; height: 144px; width: 0; }
.preload-book .sheet {
  position: absolute; top: 0; left: -2px; width: 120px; height: 144px;
  background: var(--paper);
  border-left: 1px solid #e8dfcf;
  border-right: 1px solid #e8dfcf;
  transform-origin: left center;
  border-radius: 2px;
  box-shadow: 6px 0 14px rgba(0,0,0,.25);
  animation: preFlip 1.6s ease-in-out infinite;
}
.s2 { animation-delay: .22s; }
.s3 { animation-delay: .44s; }
.preload-text h1 {
  margin: 0; color: var(--gold);
  letter-spacing: 6px; font-family:'Cinzel', serif; font-weight: 800;
}
.preload-text p { margin: 6px 0 0; color: #bbb; }

@keyframes preFlip {
  0% { transform: rotateY(0); } 
  45% { transform: rotateY(-170deg); } 
  55% { transform: rotateY(-170deg); } 
  100% { transform: rotateY(0); }
}
@keyframes preFade { to { opacity: 0; visibility: hidden; } }
#preloader.fade-out { opacity: 0; visibility: hidden; transition: opacity 1s ease, visibility 1s ease; }

/* =================== Topbar =================== */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(8,8,10,.6); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(212,175,55,.28);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  color: #eee;
}
.brand {
  font-family:'Cinzel', serif; color: var(--gold);
  letter-spacing: 3px; font-weight: 800;
}
.actions { display: flex; gap: 10px; align-items: center; }

/* Buttons */
.btn {
  appearance: none; border: none; cursor: pointer; font-weight: 700;
  padding: 12px 20px; border-radius: 14px;
  font-size: 15px; transition: all 0.25s ease;
  transform: translateY(0); text-decoration: none !important;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #1b1205; box-shadow: 0 6px 18px rgba(212,175,55,.35);
  position: relative; overflow: hidden;
}
.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(212,175,55,.55);
  filter: brightness(1.15);
}
.btn:active {
  transform: translateY(2px) scale(0.96);
  box-shadow: inset 0 4px 12px rgba(0,0,0,.35);
  filter: brightness(0.9);
}
.btn::after {
  content: ""; position: absolute; top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.5), transparent);
  transition: 0.5s;
}
.btn:hover::after { left: 100%; }

/* Special Buttons */
.btn.ghost { background: transparent; color: #eae7dc; border: 1px solid rgba(255,255,255,.18); }
.btn.ghost:hover { border-color: #fff; }
.btn.icon.close { font-size: 28px; padding: 6px 10px; color: #fff; background: transparent; }
.btn.cta { box-shadow: 0 12px 28px rgba(212,175,55,.35); }
.btn.cta:hover { filter: saturate(1.05); }
.btn.line { color: var(--gold); border: 1px solid rgba(212,175,55,.5); background: transparent; }
.btn.line:hover { background: rgba(212,175,55,.08); }

/* =================== Progress Bar =================== */
.progress { position: absolute; left:0; right:0; bottom:0; height:3px; background: rgba(255,255,255,.06); }
.progress span { display:block; height:100%; width:0; background: linear-gradient(90deg, var(--gold), var(--royal)); }

/* =================== TOC Panel =================== */
.toc-panel {
  position: fixed; inset:0 0 0 auto; width:min(420px,92vw);
  background: rgba(16,16,20,.95); color:#eee; transform: translateX(105%);
  transition: transform .35s ease; z-index: 80; border-left:1px solid rgba(212,175,55,.25);
}
.toc-panel.open { transform: translateX(0); }
.toc-inner { padding: 22px 22px 30px; }
.toc-inner h3 { margin:6px 0 14px; font-family:'Cinzel', serif; color:var(--gold); }
.toc-inner ol { margin:0; padding-left:18px; line-height:1.9; }
.toc-inner a { color:#eae7dc; text-decoration:none; }
.toc-inner a:hover { color:var(--gold); }
.scrim { position:fixed; inset:0; background:rgba(0,0,0,.45); opacity:0; pointer-events:none; transition:.25s ease; z-index:70; }
.scrim.show { opacity:1; pointer-events:auto; }

/* =================== Layout =================== */
#content { padding: 26px 0 40px; }
.page {
  width:min(1100px, 92vw); margin: 32px auto;
  background:
    linear-gradient(90deg, rgba(212,175,55,.06), transparent 10%, transparent 90%, rgba(212,175,55,.06)),
    repeating-linear-gradient(0deg, rgba(0,0,0,.02) 0 2px, transparent 2px 4px),
    var(--paper);
  color: var(--ink);
  border-radius: 16px;
  border:1px solid rgba(0,0,0,.06);
  box-shadow: 0 14px 36px rgba(0,0,0,.45);
  padding: 42px 46px;
  position: relative; overflow: hidden;
}

/* Decorative corners */
.decor-corner { position: absolute; width:72px; height:72px; border:2px solid rgba(212,175,55,.45); border-radius:12px; opacity:.35; }
.decor-corner.tl { top:14px; left:14px; border-right:none; border-bottom:none; }
.decor-corner.tr { top:14px; right:14px; border-left:none; border-bottom:none; }
.decor-corner.bl { bottom:14px; left:14px; border-right:none; border-top:none; }
.decor-corner.br { bottom:14px; right:14px; border-left:none; border-top:none; }

/* =================== Hero Section =================== */
.page-hero { text-align: center; padding: 70px 46px; }
.page-hero .title {
  font-family:'Cinzel', serif; color: var(--gold);
  font-size: clamp(34px,5vw,64px); letter-spacing:4px; margin: 0 0 8px;
}
.page-hero .subtitle { color: #5c5b5b; font-weight:700; letter-spacing:1px; margin:0 0 14px; }
.page-hero .bio { max-width: 800px; margin: 0 auto 20px; color:#4a3f2f; }
.hero-cta { display:flex; gap:12px; justify-content:center; margin-top:10px; }

/* =================== Chapters =================== */
.chapter-head { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:6px; }
.chapter-head h2 {
  margin:.2rem 0 .4rem; font-family:'Cinzel', serif; color: var(--royal); letter-spacing:.5px;
}
.ribbon {
  background:linear-gradient(90deg, rgba(212,175,55,.2), rgba(212,175,55,.05));
  border:1px solid rgba(212,175,55,.25);
  color:#7b692e; border-radius:999px; padding:6px 10px; font-size:12px; font-weight:700;
}
.grid { display:grid; grid-template-columns:1.2fr .9fr; gap:28px; align-items:start; margin-top:10px; }
.col.text .lead { font-weight:600; color:#3a2c20; }
.bullets { margin: 12px 0 18px; padding-left: 18px; }
.bullets li { margin:.4rem 0; }
.cover-card {
  background: #fff; padding:14px; border-radius:14px;
  box-shadow:0 10px 28px rgba(0,0,0,.28), inset 0 0 0 2px rgba(125,60,255,.12);
}
.cover-card img { border-radius:10px; }

/* =================== Contact =================== */
.page-contact .contact-card {
  background:#fff; border:1px solid rgba(0,0,0,.06); border-radius:14px; padding:20px;
  box-shadow:0 10px 26px rgba(0,0,0,.25);
}
.contact-card .line {
  display:flex; justify-content:space-between; align-items:center;
  padding:12px 6px; border-bottom:1px dashed rgba(0,0,0,.12);
}
.contact-card .line:last-child { border-bottom:0; }
.contact-card span { color:#6d5b45; font-weight:700; }
.contact-card a { color:#d4af37; text-decoration:none; font-weight:700; }
.contact-card a:hover { color:#d4af37; }

/* =================== Footer =================== */
.site-footer {
  width:min(1100px,92vw); margin:20px auto 0; color:#d7c9a3;
  text-align:center; padding:18px 0 8px; border-top:1px solid rgba(212,175,55,.25);
}

/* =================== Reveal on Scroll =================== */
.reveal { opacity:0; transform: translateY(18px) scale(.98); transition: .6s ease; }
.reveal.in { opacity:1; transform: none; }

/* =================== Responsive =================== */
@media (max-width: 980px) { .grid { grid-template-columns: 1fr; } .page{ padding:32px; } }
@media (max-width: 600px) {
  .chapter-head{ flex-direction:column; align-items:flex-start; }
  .page-hero{ padding:52px 26px; }
}

/* =================== Links =================== */
a, a:visited, a:hover, a:active,
button, .btn, .btn:hover, .btn:focus { text-decoration: none !important; }

/* =================== Headings =================== */
h2, h3, h4 {
  color: #d4af37 !important;
  text-transform: uppercase;
  letter-spacing: 1px;
}
h2:hover, h3:hover, h4:hover {
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255,215,0,0.7);
  transition: all 0.3s ease-in-out;
}

/* =================== Language Fonts =================== */
body:lang(en), .text-en { font-family: 'Montserrat', sans-serif; font-weight:600; }
body:lang(ar), .text-ar { font-family: 'Cairo', 'Amiri', serif; font-weight:900; }
body:lang(fr), .text-fr { font-family: 'Cormorant Garamond', serif; font-weight:700; }
body:lang(es), .text-es { font-family: 'Playfair Display', serif; font-weight:700; }
body:lang(de), .text-de { font-family: 'Merriweather', serif; font-weight:900; }
body:lang(zh), .text-zh { font-family: 'Noto Serif SC', serif; font-weight:700; }
body:lang(pt), .text-pt { font-family: 'EB Garamond', serif; font-weight:700; }

/* =================== Lead =================== */
.lead { font-size: 1.2rem; font-weight:400; line-height:1.6; }

/* =================== Mobile Enhancements =================== */
@media (max-width: 768px) {
  body { font-size: 15px; line-height:1.6; padding:0 10px; }
  header, .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .topbar .actions { order: 2; width:100%; justify-content:flex-start; }
  .lang-select { width:100%; justify-content:space-between; padding:.5rem .75rem; font-size:14px; }
  .lang-select select { width:auto; font-size:14px; }
  h1 { font-size:1.6rem; line-height:1.3; }
  h2 { font-size:1.3rem; }
  img { max-width:100%; height:auto; }
  .card, .section { width:100%; margin:10px 0; padding:15px; border-radius:10px; }
  nav ul { flex-direction: column; gap:10px; width:100%; }
  nav ul li { width:100%; text-align:left; }
  button, .btn { width:100%; padding:12px; font-size:15px; }
}
/* =================== Mobile Contact Card =================== */
@media (max-width: 768px) {
  .page-contact .contact-card {
    width: 95%;            /* عرض البطاقة مناسب للشاشة */
    margin: 16px auto;     /* تباعد من الحواف */
    padding: 16px 18px;    /* padding متناسق داخل البطاقة */
    border-radius: 12px;   /* زوايا البطاقة مناسبة للشاشة */
    box-shadow: 0 6px 12px rgba(0,0,0,0.25); /* ظل أخف */
  }

  .contact-card .line {
    flex-direction: column; /* ترتيب العناصر عمودي */
    align-items: flex-start; 
    padding: 10px 0;        /* padding داخلي لكل سطر */
    gap: 6px;
  }

  .contact-card span {
    font-size: 15px;
    font-weight: 700;
  }

  .contact-card a {
    font-size: 15px;
    font-weight: 700;
  }
}


/* =================== RTL Support =================== */
body.rtl { direction: rtl; }
body.rtl .topbar .actions { order: -1; }
.lang-select {
  display:inline-flex; align-items:center; gap:.5rem;
  border:1px solid #333; border-radius:999px; padding:.35rem .75rem;
  background: rgba(0,0,0,.6); color:#fff; font: 600 14px/1 Montserrat, system-ui;
}
.lang-select select {
  background: transparent; color: inherit; border: 0; outline: none; cursor: pointer;
}
.lang-select select option { color: #000; }
/* أزرار عامة */
.btn, 
button, 
.button {
    box-shadow: none !important;   /* إلغاء أي ضوء */
}


