/* =========================================================
   بلكع — استوديو تصميم وتطوير مواقع
   الفكرة: في العربية نقطة واحدة تغيّر المعنى. التفاصيل هي الفرق.
   و«بلكع» فيها نقطة واحدة فقط — نقطة الباء — وهي توقيع الهوية.
   ========================================================= */

:root {
  --paper: #F4EFE6;
  --ink: #1A1714;
  --ink-2: #5C554C;
  --line: rgba(26, 23, 20, .12);
  --accent: #E4572E;
  --ok: #2E9E5B;
  --grain-invert: 0;

  --font-display: "Reem Kufi", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-hand: "Aref Ruqaa", "Reem Kufi", serif;

  --wrap: 1440px;
  --gutter: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131110; --ink: #F2ECE1; --ink-2: #ADA598;
    --line: rgba(242, 236, 225, .10);
    --accent: #FF6A3D;
    --grain-invert: 1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131110; --ink: #F2ECE1; --ink-2: #ADA598;
  --line: rgba(242, 236, 225, .10);
  --accent: #FF6A3D;
  --grain-invert: 1;
  color-scheme: dark;
}

/* ---------- الأساسيات ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* الصفحة شاشة واحدة ثابتة على كل الأجهزة: بلا تمرير ولا ارتداد */
html { -webkit-text-size-adjust: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  margin: 0;
  /* الترويسة في الأعلى، و«بلكع» تملأ بقية الشاشة بالضبط */
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.85 var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
/* حُبيبات ورق خفيفة */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: .07;
  filter: invert(var(--grain-invert));
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
p { margin: 0; }
::selection { background: var(--accent); color: #1A1714; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- الترويسة ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  transition: background-color .4s;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 72px; }
.brand { font: 700 30px/1.3 var(--font-display); text-decoration: none; color: var(--ink); white-space: nowrap; }
.nav-tools { display: flex; align-items: center; gap: 10px; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--ink-2);
  white-space: nowrap;
}
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 8px transparent; }
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  transition: border-color .2s, transform .4s var(--ease);
}
.icon-btn:hover { border-color: var(--ink); transform: rotate(-20deg); }
:root[data-theme="dark"] .i-moon, :root:not([data-theme="dark"]) .i-sun { display: none; }

/* ---------- الشعار: نقطة الباء تُستخرج من الخط وتُلوَّن (انظر script.js) ---------- */
.logo { position: relative; display: inline-block; user-select: none; -webkit-user-select: none; }
.logo-text { display: inline-block; }
.logo-base { display: inline-block; width: 0; height: 0; vertical-align: baseline; }
.logo-dot {
  position: absolute;
  background: var(--accent);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  pointer-events: none;
  opacity: 0;
  transition: translate .6s cubic-bezier(.3, 1.8, .5, 1), background-color .4s;
}
.logo.has-dot .logo-dot { opacity: 1; animation: dotIn .7s .3s cubic-bezier(.3, 1.7, .5, 1) backwards; }
@keyframes dotIn { from { scale: 0; } }
.brand:hover .logo-dot { translate: 0 20%; }

/* ---------- بلكع ---------- */
.footer {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-block: 24px 28px;
  overflow: hidden;
  /* ارتفاع الشاشة، وحجم «بلكع»: كبيرة كما كانت، ولا تصغر إلا إذا قصُرت النافذة — حتى لا تتمرر الصفحة */
  --vh: 100vh;
  --mark: min(30vw, calc((var(--vh) * .95 - 190px) / 1.2), 420px);
}
@supports (height: 100svh) { .footer { --vh: 100svh; } }
.footer > .wrap { position: relative; z-index: 1; width: 100%; }
/* حقل نقاط يتفاعل مع المؤشر خلف «بلكع»، ويتلاشى نحو الأعلى */
.dotfield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(0deg, #000 0%, #000 50%, transparent 100%);
  mask-image: linear-gradient(0deg, #000 0%, #000 50%, transparent 100%);
}
/* «بلكع» في المنتصف، والعبارة في العمود الأيسر (العمودان الجانبيان متساويان فتبقى الكلمة في الوسط) */
.footer-brand {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 16px 32px;
  /* رفعة فوق خط الحقوق: ٥٪ من الشاشة، وتزيد في الشاشات الطويلة بما فيها من فراغ */
  margin-bottom: calc(var(--vh) * .05 + (var(--vh) * .95 - 190px - 1.2 * var(--mark)) * .4);
}
.footer-brand .footer-mark { grid-column: 2; grid-row: 1; }
.footer-brand .footer-tag { grid-column: 3; grid-row: 1; justify-self: end; }
.footer-mark {
  font: 700 clamp(120px, 30vw, 420px)/1.15 var(--font-display);
  font-size: var(--mark);
  color: var(--ink);
  white-space: nowrap;
  margin-bottom: .05em; /* مسافة بين ذيل العين والخط تحتها */
}
.footer-mark:hover .logo-dot { translate: 0 -35%; }
.footer-tag {
  margin-bottom: clamp(6px, 1.2vw, 20px);
  font: 400 clamp(18px, 2vw, 28px)/1.7 var(--font-hand);
  color: var(--ink-2);
  text-align: end; /* في RTL: السطران يصطفّان على حافة الصفحة اليسرى */
  white-space: nowrap; /* السطران كما هما، بلا انكسار إضافي */
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-2);
}

.footer { min-height: 0; }

/* ---------- الجوال والأجهزة اللمسية (كما هي) ---------- */
@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  .footer { touch-action: none; } /* الإصبع يحرّك النقاط بدل أن يحرّك الصفحة */
  .footer-brand { margin-bottom: 0; }
  .footer-mark { font-size: min(30vw, 48vh, 420px); font-size: min(30vw, 48svh, 420px); line-height: 1.3; margin-bottom: -.04em; }
}

/* ---------- الجوال واللوحي بالطول: «بلكع» في منتصف الشاشة، والعبارة تحتها ---------- */
@media (max-width: 640px), (max-width: 1024px) and (orientation: portrait) {
  body { font-size: 16px; }
  .nav-inner { height: 64px; gap: 12px; }
  .brand { font-size: 28px; }
  .status { padding: 4px 12px; font-size: 12.5px; }
  .icon-btn { width: 38px; height: 38px; }

  .footer { padding-block: 0 max(18px, env(safe-area-inset-bottom)); }
  .footer > .wrap { flex: 1; display: flex; flex-direction: column; }
  .footer-brand {
    flex: 1;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
    /* ترفع «بلكع» والعبارة فوق منتصف الشاشة قليلاً */
    padding-bottom: 12vh;
    padding-bottom: 12svh;
  }
  .footer-mark {
    font-size: min(44vw, 30vh);
    font-size: min(44vw, 30svh);
    margin: 0;
  }
  .footer-tag { margin: 0; font-size: clamp(21px, 6.6vw, 28px); line-height: 1.7; text-align: center; }
  .footer-row { justify-content: center; padding-top: 14px; font-size: 12.5px; text-align: center; }
  /* النقاط تتلاشى من المنتصف نحو الحواف */
  .dotfield {
    -webkit-mask-image: radial-gradient(ellipse 95% 62% at 50% 48%, #000 25%, transparent 88%);
    mask-image: radial-gradient(ellipse 95% 62% at 50% 48%, #000 25%, transparent 88%);
  }
}

/* ---------- احترام تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
