/* CloudyERP prototype — base, typography, primitives */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  background: var(--bg-1);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  /* W10: Arabic words are never broken mid-letter; very long Latin tokens (codes, URLs) may wrap */
  overflow-wrap: break-word;
}
img, svg { display: block; max-width: 100%; }
svg use { pointer-events: none; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: var(--lh-h2); text-wrap: balance; }
h1 { line-height: var(--lh-h1); }
h3 { line-height: var(--lh-h3); }
p { margin: 0; text-wrap: pretty; }
/* Latin codes and numbers inside Arabic sentences keep their own direction */
bdi, code, [dir="ltr"] { unicode-bidi: isolate; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
table { border-collapse: collapse; width: 100%; }

:focus { outline: none; }
/* W10: outline (not box-shadow) so no component shadow can hide the ring; it follows border-radius */
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: 6px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 1px; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

.skip-link {
  position: absolute; inset-inline-start: 1rem; top: -100px; z-index: 100;
  background: var(--blue-500); color: #fff; padding: .6rem 1rem; border-radius: var(--r-sm);
}
.skip-link:focus { top: 1rem; }

/* Numbers render tabular, western digits for operational data */
.kpi strong, .totals b, .cart b, .mini-ledger td, .sheet__table td, .receipt b, .receipt td,
.matrix .c, .pl b, .jv b, .br-table span, .stock-line b, .feed b, .compare b, .level b, .margin-strip b, .att b {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- Primitives ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: var(--fs-sm); font-weight: 500; color: var(--blue-300); line-height: var(--lh-meta);
}
/* Signature motif: one thread through four stations (see #sig) */
.motif { width: 34px; height: 11px; flex: none; color: var(--blue-400); }
.motif--lg { width: 44px; height: 14px; }

.btn {
  --_bg: transparent; --_fg: var(--text-1); --_bd: var(--line-3);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .55rem 1.15rem;
  border-radius: 999px; border: 1px solid var(--_bd);
  background: var(--_bg); color: var(--_fg);
  font-weight: 600; font-size: .95rem; line-height: 1.3; white-space: nowrap;
  transition: background var(--dur-1), border-color var(--dur-1), transform var(--dur-1), box-shadow var(--dur-1);
}
.btn:hover { --_bd: var(--blue-300); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  /* #1f63e8 keeps white text at 5.2:1 (W2's #2f7bff was 3.9:1) */
  --_bg: var(--blue-600); --_fg: #fff; --_bd: transparent;
  box-shadow: 0 1px 0 rgb(255 255 255 / .25) inset, 0 10px 30px -10px rgb(47 123 255 / .7);
}
.btn--primary:hover { --_bg: #1a55cf; --_bd: transparent; }
.btn--ghost { --_bg: rgb(255 255 255 / .03); }
.btn--sm { min-height: 40px; padding: .4rem .95rem; font-size: .9rem; }
.btn--lg { min-height: 52px; padding: .75rem 1.5rem; font-size: 1rem; }
.btn--block { width: 100%; }
.btn__icon { width: 18px; height: 18px; }
.btn:focus-visible { border-radius: 999px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2);
  background: rgb(255 255 255 / .02);
  transition: color var(--dur-1), border-color var(--dur-1), background var(--dur-1);
}
.icon-btn:hover { color: var(--text-1); border-color: var(--line-3); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn--sm { width: 36px; height: 36px; }
.icon-btn--sm svg { width: 16px; height: 16px; }
.icon-btn:focus-visible { border-radius: 999px; }

.link-arrow { display: inline-flex; align-items: center; gap: .4rem; min-height: 32px; color: var(--blue-300); font-weight: 600; font-size: .95rem; line-height: 1.5; text-underline-offset: .3em; }
.link-arrow svg { flex: none; width: 16px; height: 16px; transition: transform var(--dur-1); }
.link-arrow:hover svg { transform: translateX(-3px); }
.link-arrow:hover { color: var(--blue-200); text-decoration: underline; text-decoration-thickness: 1px; }

.pill {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  padding: .12rem .6rem; border-radius: 999px; font-size: var(--fs-tag); font-weight: 500; line-height: 1.6;
  background: rgb(255 255 255 / .05); color: var(--text-2); border: 1px solid var(--line-1);
}
.pill--ok { color: var(--ok); background: var(--ok-tint); border-color: rgb(63 214 156 / .2); }

.demo-tag {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  padding: .15rem .6rem; border-radius: 6px; font-size: var(--fs-tag); font-weight: 500; line-height: 1.6;
  color: var(--warn); background: var(--warn-tint); border: 1px dashed rgb(242 187 85 / .35);
}
.demo-tag--mini { font-size: var(--fs-micro); padding: 0 .45rem; }

.ticks { display: grid; gap: .6rem; }
.ticks li { position: relative; padding-inline-start: 1.6rem; color: var(--text-2); }
.ticks li::before {
  content: ""; position: absolute; inset-inline-start: .3rem; top: .5em; width: 6px; height: 11px;
  border-right: 2px solid var(--blue-400); border-bottom: 2px solid var(--blue-400);
  transform: rotate(45deg);
}

/* ---------- Prototype strip ---------- */
/* "نموذج أولي" tag, used on the demo form note */
.proto-strip__tag {
  flex: none; font-size: var(--fs-micro); font-weight: 600; color: var(--warn);
  border: 1px dashed rgb(242 187 85 / .45); border-radius: 5px; padding: 0 .4rem; line-height: 1.7;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgb(6 10 21 / .72);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-2), background var(--dur-2);
}
.site-header.is-scrolled { border-color: var(--line-1); background: rgb(6 10 21 / .9); }
/* W11A light header: tokens come from the light tone block in editorial.css; only the glass is set here */
.site-header.is-light { background: rgb(246 247 250 / .9); border-color: var(--line-1); }
.site-header.is-light .lang { color: var(--text-3); }
@media (prefers-reduced-motion: reduce) { .site-header { transition: none; } }
.site-header__inner { display: flex; align-items: center; gap: 2rem; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: .6rem; flex: none; }
.brand__mark { width: 36px; height: 36px; flex: none; }
.brand__word { font-family: "Readex Pro", system-ui, sans-serif; font-size: 1.22rem; font-weight: 500; letter-spacing: -.01em; color: var(--text-1); }
.brand__word b { font-weight: 700; color: var(--blue-300); }
.site-nav { margin-inline-end: auto; }
.site-nav ul { display: flex; gap: .25rem; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 40px; padding: .3rem .85rem; border-radius: 999px;
  color: var(--text-2); font-size: .95rem; transition: color var(--dur-1), background var(--dur-1);
}
.site-nav a:hover { color: var(--text-1); background: rgb(255 255 255 / .04); }
.site-nav a.is-current { color: var(--text-1); }
.site-header__actions { display: flex; align-items: center; gap: .5rem; }
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .site-header__inner { gap: 1rem; justify-content: space-between; }
  .nav-toggle { display: inline-grid; }
  .site-nav {
    position: absolute; inset-inline: 0; top: 100%;
    background: rgb(6 10 21 / .97); border-bottom: 1px solid var(--line-2);
    padding: .75rem var(--gutter) 1.25rem; margin: 0;
    display: none;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; }
  .site-nav a { width: 100%; min-height: 48px; font-size: 1.05rem; border-radius: var(--r-sm); }
}
@media (max-width: 420px) {
  .site-header__actions .btn { padding-inline: .8rem; font-size: .82rem; }
  .brand__word { font-size: 1.1rem; }
}
/* W5: brand + header CTA + menu measured 343px at a 320px viewport. Below 360px the header keeps brand + menu;
   the hero's full-width primary CTA sits directly under it. */
@media (max-width: 359px) {
  .site-header__actions .btn { display: none; }
}

/* ---------- Section heads ---------- */
.section-head { display: grid; gap: 1.1rem; max-width: 760px; margin-bottom: clamp(2.5rem, 2rem + 3vw, 4.5rem); }
.section-head h2 { font-size: var(--fs-h2); font-weight: 600; letter-spacing: 0; line-height: var(--lh-h2); }
.section-head__lead { color: var(--text-2); font-size: var(--fs-lead); line-height: var(--lh-lead); max-width: var(--measure); }
.section-head--split { max-width: none; grid-template-columns: 1.1fr 1fr; align-items: end; gap: 2rem 4rem; }
@media (max-width: 860px) { .section-head--split { grid-template-columns: 1fr; } }

/* ---------- W10: touch targets ----------
   On touch screens every stand-alone link and control gets a ~44px hit area. Links inside running
   text keep their natural size (WCAG 2.5.8 inline exception). */
@media (pointer: coarse), (max-width: 860px) {
  .link-arrow { min-height: var(--tap); }
  .btn--sm { min-height: var(--tap); }
}

/* ---------- Scroll reveal (W7: progressive enhancement) ----------
   Content is ALWAYS visible by default: there is no resting opacity:0 state.
   JS only adds .is-in to a block just before it scrolls into view, which plays a one-shot
   entrance keyframe. No JS, no IntersectionObserver, reduced motion, print or a full-page
   capture all show every block at full opacity. */
@keyframes revealIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.reveal.is-in { animation: revealIn .8s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal.is-in { animation: none; }
}
@media print { .reveal.is-in { animation: none; } }
/* W11A: light header keeps the mega panel readable (its dark glass is hard-coded in pages.css) */
.site-header.is-light .mega__panel { background: #fff; box-shadow: 0 30px 70px -24px rgb(10 20 48 / .35); }
.site-header.is-light :is(.mega__top:hover, .mega__top[aria-expanded="true"], .mega__link:hover) { background: rgb(16 34 80 / .05); }
