/* نظام تصميم المقامة: الرموز المعتمدة
   الأوضاع: [data-theme="light" | "dark" | "paper"] على <html> */

@font-face{font-family:"Tajarib";src:url(fonts/tajarib-light.woff) format("woff");font-weight:300;font-display:swap}
@font-face{font-family:"Tajarib";src:url(fonts/tajarib-regular.woff) format("woff");font-weight:400;font-display:swap}
@font-face{font-family:"Tajarib";src:url(fonts/tajarib-medium.woff) format("woff");font-weight:500;font-display:swap}
@font-face{font-family:"Tajarib";src:url(fonts/tajarib-bold.woff) format("woff");font-weight:700;font-display:swap}
@font-face{font-family:"Tajarib";src:url(fonts/tajarib-black.woff) format("woff");font-weight:900;font-display:swap}

:root, [data-theme="light"]{
  --paper:#EFEBE1; --sheet:#FAF8F2; --sheet-2:#F3EFE5;
  --ink:#1E1C19; --ink-2:#4A4640; --ink-3:#645F57;
  --rule:#DDD6C6; --rule-2:#CBC2AE;
  --brand:#6E1E2B; --brand-hover:#5A1823; --brand-active:#4A131C; --brand-soft:#EEDBDC; --on-brand:#FFFFFF;
  --gold:#7E5B12; --gold-soft:#F1E6C8;
  --error:#C0392B; --error-soft:#F6DEDA;
  --success:#2E7D4F; --success-soft:#E1EEE5;
  --focus:#2D4A7A;
  --scrim:rgba(12,12,14,.45);
  --shadow:0 1px 0 rgba(28,30,34,.04),0 8px 24px -12px rgba(28,30,34,.18);
  --shadow-pop:0 30px 70px -20px rgba(0,0,0,.5);
}
[data-theme="dark"]{
  --paper:#14120F; --sheet:#1C1A16; --sheet-2:#23201B;
  --ink:#ECE6D8; --ink-2:#BDB6A6; --ink-3:#8C8577;
  --rule:#2F2B25; --rule-2:#3D3830;
  --brand:#D98A95; --brand-hover:#E39EA8; --brand-active:#EDB2BA; --brand-soft:rgba(217,138,149,.14); --on-brand:#14120F;
  --gold:#D8B060; --gold-soft:rgba(216,176,96,.15);
  --error:#FF8A7A; --error-soft:rgba(255,138,122,.14);
  --success:#6FBF8E; --success-soft:rgba(111,191,142,.14);
  --focus:#8FB0E8;
  --scrim:rgba(0,0,0,.6);
  --shadow:0 1px 0 rgba(0,0,0,.3),0 10px 30px -14px rgba(0,0,0,.7);
}
[data-theme="paper"]{
  --paper:#E9DFCB; --sheet:#F6EFDF; --sheet-2:#EFE6D3;
  --ink:#3A2D1F; --ink-2:#5E4E3B; --ink-3:#76664F;
  --rule:#DCCFB5; --rule-2:#CDBE9F;
  --brand:#7A2E2E; --brand-hover:#662626; --brand-active:#541F1F; --brand-soft:#E8D0C4; --on-brand:#FFFFFF;
  --gold:#7C5A12; --gold-soft:#E7D5A6;
  --error:#B83A26; --error-soft:#EDCDBD;
  --success:#3F6B3A; --success-soft:#DCDDBE;
  --focus:#2D4A7A;
  --scrim:rgba(12,12,14,.45);
}

:root{
  /* أغلفة الكتب: ثابتة في كل الأوضاع */
  --cover-1:#6E1E2B; --cover-2:#2A2620; --cover-3:#5B4418; --cover-4:#1F4A3C; --cover-5:#22345E; --cover-6:#7A3B22;
  --cover-ink:#F6EFDF; --cover-frame:rgba(216,176,96,.55);

  /* الخط: دوران */
  --font-fixed:"Tajarib",system-ui,sans-serif;
  --font-reader:"Tajarib","Amiri",sans-serif;  /* يتبدل بإعداد القارئ: أميري / نسخ */
  --lh-reader:2.1;                              /* أميري 2.05 · نسخ 2.15 */

  /* الأحجام */
  --text-xs:.75rem; --text-sm:.85rem; --text-md:.95rem; --text-lg:1.12rem;
  --text-read:1.32rem;   /* درجات القارئ: 1.05 1.15 1.25 1.32 1.45 1.6 1.75 1.9 */
  --text-h3:1.5rem; --text-h2:1.9rem; --text-h1:2.6rem;
  --text-display:clamp(2.5rem,5.5vw,3.9rem);

  /* المسافات */
  --space-1:2px; --space-2:4px; --space-3:6px; --space-4:8px; --space-5:12px;
  --space-6:16px; --space-7:20px; --space-8:24px; --space-9:32px; --space-10:48px;

  /* الزوايا */
  --r-pill:999px; --r-card:10px; --r-sheet:4px; --r-modal:14px; --r-bottom-sheet:18px;

  /* العرض */
  --maxw:1180px; --maxw-read:900px; --edge:20px;

  /* الحركة */
  --dur-xs:160ms; --dur-sm:220ms; --dur-md:280ms; --dur-lg:360ms;
  --ease:cubic-bezier(.2,.7,.2,1);

  /* التحكم */
  --control-h:40px; --control-h-sm:32px;
}

/* نقاط الانكسار: 640 و980 */
@media (max-width:980px){ :root{ --space-10:32px } }
@media (max-width:639px){ :root{ --edge:16px; --control-h:44px; --space-9:24px } }

/* قواعد عامة */
html{ -webkit-text-size-adjust:100%; touch-action:manipulation }
input, select, textarea{ font-size:max(16px,1em) }
@media (prefers-reduced-motion:reduce){ *{ animation:none!important; transition-property:color,background-color,border-color,opacity!important } }
