/* ==========================================================================
   NARD CREATIVE — base.css
   الأساسيات: المتغيرات، الخطوط، الشبكة، الأزرار، الهيدر، الفوتر
   ========================================================================== */

/* ---------- 1. المتغيرات ---------- */
:root {
  /* الألوان */
  --bg:        #212322;   /* فحمي — خلفية الموقع */
  --bg-2:      #341A17;   /* بني محروق — البطاقات والأسطح */
  --ink:       #E7EEE2;   /* أوف وايت — النصوص */
  --cream:     #E7EEE2;   /* أوف وايت */
  --brown:     #341A17;
  --ink-soft:  rgba(231, 238, 226, 0.84);
  --muted:     rgba(231, 238, 226, 0.68);
  --line:      rgba(231, 238, 226, 0.20);
  --line-soft: rgba(231, 238, 226, 0.11);
  --cta-bg:    #341A17;

  /* المقاسات */
  --container: 1320px;
  --gutter:    clamp(20px, 5vw, 72px);
  --section-y: clamp(84px, 11vw, 168px);
  --radius:    28px;      /* زوايا دائرية كبيرة — أسلوب البطاقات */
  --radius-lg: 40px;
  --radius-sm: 16px;

  /* الخطوط */
  --font-ar: "Markazi Text", "Segoe UI", Tahoma, sans-serif;
  --font-en: "Markazi Text", "Segoe UI", sans-serif;

  /* الحدّ الأدنى مرفوع عشان الهرمية تبقى واضحة على الجوال:
     العنوان ٣× حجم النص بدل ٢× */
  --fs-display: clamp(3rem, 7.2vw, 6rem);
  --fs-h2:      clamp(2.4rem, 5vw, 4rem);
  --fs-h3:      clamp(1.45rem, 2.2vw, 1.68rem);
  --fs-body:    clamp(1.16rem, 1.22vw, 1.24rem);
  --fs-small:   0.94rem;
  --fs-micro:   0.8rem;

  /* الحركة — سلّم واحد لكل الموقع */
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast:    .18s;
  --t:         .32s;
  --t-slow:    .55s;

  /* ---- نظام عناصر التحكّم ---- */
  /* ارتفاعان فقط — كلاهما فوق حدّ اللمس 44px أو يساويه */
  --ctl-sm:    40px;
  --ctl-md:    48px;
  --ctl-lg:    56px;
  --ctl-px-sm: 18px;
  --ctl-px-md: 28px;
  --ctl-fs-sm: 0.94rem;    /* 15px بعد تعويض Markazi */
  --ctl-fs-md: 1.08rem;    /* 17px بعد تعويض Markazi */
  /* نصف القطر: الأفعال مستطيلات ناعمة، الأيقونات دوائر،
     والأسطح 28/40px، والكبسولة الكاملة للشريط والشارة فقط */
  --r-ctl:     14px;
  --r-ctl-sm:  11px;

  /* الحدود — مفصولة حسب الوظيفة:
     edge      = زخرفي (فواصل، حواف بطاقات) — لا ينطبق عليه WCAG 1.4.11
     edge-ctl  = حدّ عنصر تفاعلي — 3.16:1 مقابل الخلفية ✓
     edge-light= حدّ عنصر تفاعلي فوق الداكن — 3.55:1 ✓ */
  --edge:        rgba(231, 238, 226, 0.18);
  --edge-ctl:    rgba(231, 238, 226, 0.54);
  --edge-strong: rgba(231, 238, 226, 0.78);
  --edge-light:  rgba(231, 238, 226, 0.48);

  /* السطح الناعم (الزجاجي) */
  --soft:       rgba(231, 238, 226, 0.10);
  --soft-hover: rgba(231, 238, 226, 0.18);

  --ink-hover:  #F6FAF3;
}

/* ---------- 2. إعادة الضبط ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 112px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ar);
  font-size: var(--fs-body);
  line-height: 1.9;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* clip لا ينشئ حاوية تمرير، فيبقى position:sticky شغّالاً */
  overflow-x: clip;
}

body.is-locked { overflow: hidden; }

img, svg, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--ink); color: var(--brown); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

/* مرئي للقارئ الصوتي فقط */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- 3. الطباعة ---------- */
h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;           /* لا تباعد للحروف العربية — يكسر اتصالها */
}

.display {
  font-family: var(--display-face);
  font-size: var(--fs-display);
  font-weight: 700;
  line-height: 1.18;
}

.h2 { font-family: var(--display-face); font-size: var(--fs-h2); line-height: 1.28; }
.h3 { font-family: var(--display-face); font-size: var(--fs-h3); line-height: 1.5; }

p { margin: 0; }

.lead {
  font-size: clamp(1.22rem, 1.74vw, 1.5rem);
  line-height: 1.8;
  color: var(--ink-soft);
}

.muted { color: var(--muted); }

/* النص اللاتيني فقط يأخذ تباعد حروف */
.en {
  font-family: var(--font-en);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  direction: ltr;
  unicode-bidi: isolate;
}

/* العنوان الصغير فوق كل قسم */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-micro);
  color: var(--muted);
  margin-bottom: 22px;
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink);
  flex: none;
}

/* ---------- 4. التخطيط ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(56px, 7vw, 104px); }

.section-head { max-width: 760px; margin-bottom: clamp(44px, 6vw, 80px); }
.section-head p { margin-top: 18px; }

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- 5. الأزرار — نظام واحد لكل عناصر التحكّم ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--ctl-md);
  padding-inline: var(--ctl-px-md);
  border-radius: var(--r-ctl);
  border: 1px solid transparent;
  font-size: var(--ctl-fs-md);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition:
    background    var(--t) var(--ease),
    color         var(--t) var(--ease),
    border-color  var(--t) var(--ease),
    box-shadow    var(--t) var(--ease),
    transform     var(--t-fast) var(--ease);
}
.btn:active { transform: translateY(1px) scale(0.985); }

.btn--sm {
  height: var(--ctl-sm);
  padding-inline: var(--ctl-px-sm);
  border-radius: var(--r-ctl-sm);
  font-size: var(--ctl-fs-sm);
  gap: 8px;
}

/* دائري لأزرار الأيقونات */
.btn--icon {
  width: var(--ctl-md);
  height: var(--ctl-md);
  padding: 0;
  border-radius: 50%;
  flex: none;
}
.btn--icon.btn--sm { width: var(--ctl-sm); height: var(--ctl-sm); }

/* ١. أساسي — مصمت. الـhover يرفعه ويفتح درجته، ما يقلب هويته */
.btn--solid {
  background: var(--ink);
  color: var(--brown);
  box-shadow: 0 8px 20px -10px rgba(49, 22, 21, 0.55);
}
.btn--solid:hover {
  background: var(--ink-hover);
  box-shadow: 0 16px 30px -12px rgba(49, 22, 21, 0.6);
  transform: translateY(-2px);
}

/* ٢. ثانوي — سطح ناعم بحدّ شعرة. أخفّ بوضوح من الأساسي */
.btn--soft {
  background: var(--soft);
  color: var(--ink);
  border-color: var(--edge-ctl);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(231, 238, 226, 0.18);
}
.btn--soft:hover {
  background: var(--soft-hover);
  border-color: var(--edge-strong);
  transform: translateY(-2px);
}

/* ٣. هادئ — بلا سطح، للسياقات المزدحمة */
.btn--quiet { background: transparent; color: var(--ink); border-color: var(--edge-ctl); }
.btn--quiet:hover { background: var(--soft); border-color: var(--edge-strong); transform: translateY(-2px); }

/* ٤. فوق الخلفيات الداكنة */
.btn--light {
  background: var(--cream);
  color: var(--brown);
  box-shadow: 0 8px 22px -10px rgba(0, 0, 0, 0.6);
}
.btn--light:hover { background: #fff; transform: translateY(-2px); }

.btn--outline-light {
  background: rgba(238, 236, 230, 0.08);
  color: var(--cream);
  border-color: var(--edge-light);
}
.btn--outline-light:hover {
  background: rgba(238, 236, 230, 0.18);
  border-color: rgba(238, 236, 230, 0.55);
  transform: translateY(-2px);
}

.btn[disabled] { opacity: .38; pointer-events: none; }

/* أيقونة نقاط داخل زر */
.btn .pip-icon { width: 16px; height: 16px; gap: 2px; }
.btn--icon .pip-icon { width: 19px; height: 19px; gap: 3px; }
.btn .pip { transition: background var(--t) var(--ease); }
.btn--solid .pip, .btn--light .pip { background: var(--brown); }
.btn--solid:hover .pip, .btn--light:hover .pip { background: var(--brown); }
.btn--outline-light .pip { background: var(--cream); }

/* حلقة التركيز — تتكيّف مع الخلفية */
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.btn--light:focus-visible,
.btn--outline-light:focus-visible { outline-color: var(--cream); }

/* رابط بسهم */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--edge);
  transition: border-color var(--t) var(--ease), gap var(--t) var(--ease);
}
.arrow-link:hover { border-color: var(--ink); gap: 18px; }
.arrow-link i { font-style: normal; transform: scaleX(-1); }

/* ---------- 6. الشعار ---------- */
/* نسخة نصية تحاكي شكل الشعار: CREATIVE STUDIO / نرد / NARD.
   لو حطيت ملف الشعار في logo.svg أو logo.png
   يستبدلها الموقع تلقائياً (شوف initLogo في main.js). */
.logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1;
}
.logo__en    { font-size: 0.44rem; color: var(--muted); }
.logo__word  { font-size: 1.7rem; font-weight: 800; letter-spacing: 0; margin-block: 1px 2px; }
.logo__latin { font-size: 0.6rem; font-weight: 500; }

/* عند وجود ملف شعار حقيقي */
.logo--img { display: block; }
.logo img  { width: auto; height: 52px; }
.footer .logo img { height: 62px; }

/* ---------- 7. الهيدر — شريط زجاجي عائم ---------- */
.header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 90;
  display: flex;
  justify-content: center;
  padding: 16px var(--gutter) 0;
  pointer-events: none;           /* يمرّر النقر للصفحة خارج الكبسولة */
  transition: padding .45s var(--ease);
}
.header.is-stuck { padding-top: 10px; }

/* الكبسولة الزجاجية */
.navpill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px;
  max-width: 100%;
  border-radius: 999px;
  background: rgba(235, 237, 226, 0.82);   /* #EBEDE2 */
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 16px 38px -20px rgba(0, 0, 0, 0.75);
  transition: background .5s var(--ease), box-shadow .5s var(--ease);
}
.header.is-stuck .navpill {
  background: #EBEDE2;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 20px 48px -20px rgba(0, 0, 0, 0.85);
}

/* الشعار داخل الكبسولة */
.navpill__logo {
  display: flex;
  align-items: center;
  min-height: var(--ctl-sm);
  padding-inline: 18px 12px;
  flex: none;
  color: var(--brown);
}
.navpill__logo .logo__word { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.navpill__logo img { height: 30px; width: auto; }

/* الروابط + المؤشر المنزلق */
.navpill__nav {
  position: relative;
  display: flex;
  align-items: center;
}
.nav__link {
  display: flex;
  align-items: center;
  height: var(--ctl-sm);
  line-height: 1.3;
  position: relative;
  z-index: 1;
  padding: 0 17px;
  border-radius: 999px;
  font-size: 0.92rem;
  color: rgba(52, 26, 23, 0.78);
  white-space: nowrap;
  transition: color .3s var(--ease);
}
.nav__link:hover { color: var(--brown); }
.nav__link.is-active { color: #EBEDE2; }

.navpill__marker {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--brown);
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.45);
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  transition: transform .5s var(--ease), width .5s var(--ease), opacity .35s var(--ease);
}

/* الزر الدائري — يرمي النرد. يرث مقاسه من .btn--icon */
.navpill__action {
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95),
              0 6px 16px -9px rgba(49, 22, 21, 0.45);
}
.navpill__action:hover { background: var(--cream); border-color: var(--cream); transform: translateY(-2px); }

.navpill__action.is-rolling { animation: nav-roll .65s var(--ease); }
@keyframes nav-roll {
  40%  { transform: rotate(200deg) scale(0.86); }
  100% { transform: rotate(360deg) scale(1); }
}

/* ---------- 7ب. الشريط على الجوال: نفس شكل الديسكتوب ----------
   الروابط ظاهرة دائماً — بدون قائمة منسدلة ولا زر همبرغر.
   خمسة روابط بعرض متساوٍ تملأ الشريط. */
@media (max-width: 760px) {
  .header { padding-inline: 12px; }

  .navpill {
    width: 100%;
    gap: 0;
    padding: 6px;
  }
  .navpill__logo,
  .navpill__action { display: none; }

  .navpill__nav { flex: 1; }
  .nav__link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-inline: 4px;
    font-size: 0.78rem;
    text-align: center;
    min-height: 40px;
  }
}

/* رابط التخطّي — يظهر فقط عند التركيز بالكيبورد (WCAG 2.4.1) */
.skip-link {
  position: fixed;
  inset-block-start: 12px;
  inset-inline-start: 50%;
  transform: translate(50%, -160%);
  z-index: 200;
  background: var(--ink);
  color: var(--brown);
  padding: 12px 22px;
  border-radius: var(--r-ctl);
  font-size: var(--ctl-fs-sm);
  box-shadow: 0 12px 28px -14px rgba(49, 22, 21, 0.7);
  transition: transform var(--t) var(--ease);
}
.skip-link:focus-visible {
  transform: translate(50%, 0);
  outline: 2px solid var(--cream);
  outline-offset: 2px;
}
#main:focus { outline: none; }

/* ---------- 9. شاشة الدخول ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  transition: clip-path 1s var(--ease);
}
.loader.is-done { clip-path: inset(0 0 100% 0); pointer-events: none; }
.loader__label { font-size: var(--fs-micro); color: var(--muted); }

/* ---------- 10. الظهور بالسكرول ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
  transition-delay: var(--d, 0ms);
}
[data-reveal].is-visible { opacity: 1; transform: none; }
[data-reveal="fade"] { transform: none; }

/* ---------- 11. الشاشات الصغيرة ---------- */
@media (max-width: 560px) {
  .btn { padding: 14px 24px; }
}

/* ---------- 12. تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
