/* هل تعلم؟ — أنماط الموقع. الرموز والقرارات في DESIGN.md.
   هوية فاتحة: أبيض نقي + كوبالت واحد يحمل الهيدر والهيرو والأزرار. خط Alexandria. */

:root {
  --bg: #ffffff;
  --surface: #f1f4f9;
  --ink: #1f2a3a;
  --muted: #4f5d70;
  --line: #d9dfe8;
  --brand: #1d5fb4;
  --brand-deep: #163f7a;
  --brand-ink: #f7faff;
  --brand-tint: #c9dbf4;
  --accent: #f2c14e;
  --z-sticky: 10;
  --z-toast: 30;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

@supports (color: oklch(0 0 0)) {
  :root {
    --bg: oklch(1 0 0);
    --surface: oklch(0.965 0.012 230);
    --ink: oklch(0.22 0.02 230);
    --muted: oklch(0.44 0.03 230);
    --line: oklch(0.88 0.01 230);
    --brand: oklch(0.5 0.17 230);
    --brand-deep: oklch(0.36 0.12 232);
    --brand-ink: oklch(0.98 0.01 230);
    --brand-tint: oklch(0.88 0.06 230);
    --accent: oklch(0.84 0.15 85);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Alexandria", "Segoe UI", Tahoma, system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.8;
  text-wrap: pretty;
}

img { max-width: 100%; }

a { color: var(--brand); }

h1, h2, h3 {
  margin: 0 0 0.5em;
  font-weight: 800;
  line-height: 1.3;
  text-wrap: balance;
}

p { margin: 0 0 1em; max-width: 70ch; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  top: -4rem;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  z-index: var(--z-toast);
}
.skip:focus { top: 1rem; }

/* ---------- الحاويات ---------- */

.wrap {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.narrow { max-width: 46rem; }

.section { padding-block: clamp(3rem, 8vw, 6rem); }
.section + .section { padding-top: 0; }

.display {
  font-size: clamp(2rem, 1.2rem + 3.5vw, 3.6rem);
  line-height: 1.25;
}

.h1 { font-size: clamp(1.6rem, 1.1rem + 2vw, 2.6rem); }
.h2 { font-size: clamp(1.4rem, 1rem + 1.6vw, 2rem); }

.lead {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 58ch;
}

/* ---------- الهيدر ---------- */

.top {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1;
}
.brand img { border-radius: 10px; }
.brand .q { color: var(--brand); }

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav a:not(.btn) {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.nav a:not(.btn):hover,
.nav a[aria-current] { color: var(--brand); }

@media (max-width: 40rem) {
  .nav a:not(.btn) { display: none; }
}

/* ---------- الأزرار ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: var(--brand);
  color: var(--brand-ink);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}
.btn:hover { background: var(--brand-deep); }
.btn-sm { min-height: 2.5rem; padding: 0.35rem 1rem; font-size: 0.95rem; }
.btn-lg { min-height: 3.5rem; padding: 0.8rem 1.8rem; font-size: 1.1rem; }

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border-color: var(--brand);
}
.btn-ghost:hover { background: var(--surface); color: var(--brand-deep); }

.btn-on-brand { background: var(--brand-ink); color: var(--brand); }
.btn-on-brand:hover { background: #fff; color: var(--brand-deep); }

.btn-ghost-on-brand {
  background: transparent;
  color: var(--brand-ink);
  border-color: rgb(255 255 255 / 0.65);
}
.btn-ghost-on-brand:hover { background: rgb(255 255 255 / 0.12); border-color: #fff; }

.ico { width: 1.25rem; height: 1.25rem; flex: none; }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ---------- الهيرو (الصفحة الرئيسية) ---------- */

.hero {
  background: var(--brand);
  color: var(--brand-ink);
  padding-block: clamp(3rem, 9vw, 7rem);
}

.hero-grid {
  display: grid;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
@media (min-width: 56rem) {
  .hero-grid { grid-template-columns: 1.05fr 0.95fr; }
}

.hero .display { color: #fff; margin-bottom: 1rem; }
.hero .display .q { color: var(--accent); }
.hero .lead { color: var(--brand-tint); }

.fact-live-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  color: var(--brand-tint);
}
.fact-live-label::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
}

.fact-live-text {
  margin: 0 0 1.25rem;
  font-size: clamp(1.35rem, 1rem + 1.6vw, 2.1rem);
  line-height: 1.75;
  color: #fff;
  max-width: none;
  transition: opacity 200ms var(--ease-out);
}
.fact-live-text.is-fading { opacity: 0; }

.fact-live-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.reveal { animation: rise 480ms var(--ease-out) both; }
.reveal-late { animation-delay: 120ms; }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
}

/* ---------- اللقطات ---------- */

.screens {
  display: grid;
  gap: 2.5rem;
  align-items: end;
  margin-top: 2.5rem;
}
@media (min-width: 48rem) {
  .screens { grid-template-columns: repeat(3, 1fr); }
  .screens > :nth-child(2) { transform: translateY(-1.75rem); }
}

.screen { margin: 0; }

.phone {
  aspect-ratio: 540 / 930;
  max-width: 270px;
  margin-inline: auto;
  border: 10px solid var(--ink);
  border-radius: 2.4rem;
  overflow: hidden;
  background: #111;
  box-shadow: 0 32px 64px -32px rgb(31 42 58 / 0.45);
}
.phone img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen figcaption {
  margin-top: 1rem;
  text-align: center;
  color: var(--muted);
}

/* ---------- التصنيفات ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.4rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  transition: background-color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}
.chip:hover { background: var(--surface); border-color: var(--brand); }
.chip .n { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.chip[aria-current] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}
.chip[aria-current] .n { color: var(--brand-tint); }

/* ---------- لماذا ---------- */

.why {
  display: grid;
  gap: 1.25rem 3rem;
  margin: 2rem 0 0;
  max-width: 64rem;
}
@media (min-width: 48rem) {
  .why { grid-template-columns: repeat(3, 1fr); }
}
.why div { border-top: 1px solid var(--line); padding-top: 1.25rem; }
.why dt {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--brand-deep);
  margin-bottom: 0.35rem;
}
.why dd { margin: 0; color: var(--muted); }

/* ---------- صفحة المعلومة ---------- */

.fact-hero { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

.cat {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}
a.cat:hover { text-decoration: underline; }

.fact-text {
  margin: 0;
  max-width: 36ch;
  font-size: clamp(1.5rem, 1.1rem + 2vw, 2.5rem);
  font-weight: 400;
  line-height: 1.75;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.75rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  margin-top: 2.5rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.pager a {
  max-width: 48%;
  color: var(--ink);
  text-decoration: none;
}
.pager a:hover { color: var(--brand); }
.pager small {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}
.pager .next { text-align: left; margin-inline-start: auto; }

.related {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}
.related li { border-bottom: 1px solid var(--line); }
.related a {
  display: block;
  padding: 1rem 0;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.1rem;
}
.related a:hover { color: var(--brand); }

.download {
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: 1.5rem;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  margin-block: 3rem 0;
}
.download h2 { color: #fff; }
.download p { color: var(--brand-tint); }

/* ---------- صفحة التصنيف ---------- */

.page-head { padding-block: clamp(2.5rem, 6vw, 4rem) 1rem; }
.page-head .lead { margin-bottom: 0; }

.facts-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  max-width: 52rem;
}
.facts-list li { border-bottom: 1px solid var(--line); }
.facts-list a {
  display: block;
  padding: 1.1rem 0;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.1rem;
}
.facts-list a:hover { color: var(--brand); }

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
}
.pagination span { color: var(--muted); padding-inline: 0.5rem; }

/* ---------- التذييل ---------- */

.foot {
  margin-top: clamp(3rem, 8vw, 6rem);
  padding-block: 2.5rem;
  background: var(--brand-deep);
  color: var(--brand-tint);
}
.foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.foot-brand { margin: 0; color: #fff; font-weight: 800; }
.foot-tag { margin-inline-start: 0.5rem; font-weight: 400; color: var(--brand-tint); }
.foot-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.foot-links a { color: #fff; text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.foot-copy { margin: 0; width: 100%; font-size: 0.875rem; }

/* ---------- صفحات الخطأ ---------- */

.error-code {
  margin: 0;
  font-size: 4.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--brand);
}

/* ---------- صفحة الخصوصية ---------- */

.prose h2 { font-size: 1.3rem; margin-top: 2rem; }
.prose ul { padding-inline-start: 1.25rem; }
.prose li { margin-bottom: 0.4rem; }

/* ---------- تنبيه ---------- */

.toast {
  position: fixed;
  inset-inline: 1rem;
  bottom: 1.25rem;
  width: max-content;
  max-width: calc(100% - 2rem);
  margin-inline: auto;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  z-index: var(--z-toast);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- الحركة المخفَّفة ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
  }
}
