@import "./components/hero.css";
@import "./components/cards.css";
@import "./components/forms.css";
@import "./components/modal.css";
@import "./components/accordion.css";
@import "./components/stats.css";
@import "./components/utilities.css";
@import "./components/navbar.css";
@import "./components/footer.css";
@import "./pages/home.css";

/* =============================================================
   DESIGN TOKENS — Single Source of Truth
   كل صفحة أو كومبوننت جديد لازم يستخدم المتغيرات دي.
   ممنوع أي ملف CSS يعمل container أو breakpoint خاص بيه.

   ═══════════════════════════════════════════════════════════
   MIGRATED — "THE DOSSIER" identity (ink + gold + parchment)
   This used to be a navy/green/cream palette. Site-wide decision:
   unify EVERY page onto the ink+gold+parchment system that was
   originally built only for /articles/ and /case-studies/.
   Token NAMES kept identical on purpose so every existing
   component/page file that reads --color-secondary,
   --color-background, etc. picks up the new palette automatically
   with zero changes to those files. Only the VALUES changed here.
   ============================================================= */
:root {
  /* ── Colors ─────────────────────────────────────────── */
  --color-primary: #0a130e;              /* was #000000 -> ap-ink (near-black, warm green cast) */
  --color-secondary: #036d36;            /* unchanged -> ap-emerald (already matched the dossier accent) */
  --color-background: #ece6d7;           /* was #fbf9f4 -> ap-parchment */
  --color-surface: #fdfdfb;              /* was #fbf9f4 -> ap-surface (cards/panels, slightly lighter than page bg) */
  --color-on-surface: #0c1c14;           /* was #1b1c19 -> ap-text */
  --color-on-surface-variant: #56655a;   /* was #44474c -> ap-text-soft */
  --color-outline-variant: #d9d2bf;      /* was #c4c6cd -> ap-parchment-line */
  --color-secondary-container: #99f3ae;  /* unchanged -> light-green glow/hover, still reads fine on ink */
  --color-on-secondary-container: #0d723a;
  --color-error-container: #ffdad6;
  --color-primary-container: #070d09;    /* was #0a1d2f (navy) -> ap-ink-deep, dark surfaces (navbar, CTA blocks) */

  /* ── New dossier-only tokens (gold accent + ink shades) ── */
  --color-gold: #b6903a;
  --color-emerald-bright: #1fae62;
  --color-ink: #0a130e;
  --color-ink-deep: #070d09;
  --color-parchment: #ece6d7;
  --color-parchment-line: #d9d2bf;
  --color-on-ink: #eef1ea;
  --color-on-ink-soft: rgba(238, 241, 234, 0.64);

  --font-family-sans: 'IBM Plex Sans Arabic', ui-sans-serif, system-ui, sans-serif;
  --font-family-display: 'Cairo', 'Segoe UI', system-ui, sans-serif;
  --font-family-mono: 'JetBrains Mono', 'Courier New', monospace;

  --radius-card: 1rem;
  --radius-control: 0.75rem;
  --radius-pill: 9999px;

  /* ── THE single container width for the whole site ───── */
  --container-max: 1280px;

  /* ── Horizontal page padding (fluid, no page overrides this) ── */
  --page-px: clamp(1rem, 4vw, 2.5rem);

  /* ── Vertical rhythm scale (use for section padding-block) ──── */
  --space-xs: clamp(0.75rem, 1.5vw, 1rem);
  --space-sm: clamp(1rem, 2vw, 1.5rem);
  --space-md: clamp(1.5rem, 3vw, 2.5rem);
  --space-lg: clamp(2.5rem, 5vw, 4rem);
  --space-xl: clamp(3.5rem, 7vw, 6rem);
  --space-2xl: clamp(4.5rem, 9vw, 8rem);

  --gutter: 1.5rem;

  --navbar-height: 5rem;

  /* ── Reference breakpoints (documentation — see guide) ──
     mobile:  0    – 767px
     tablet:  768  – 1023px
     desktop: 1024 – 1279px
     wide:    1280px+
     Always author mobile-first: base styles = mobile,
     then min-width: 768px / 1024px / 1280px to scale up. */
}

@media (min-width: 1024px) {
  :root {
    --navbar-height: 7rem;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-family: var(--font-family-sans);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-background);
  color: var(--color-on-surface);
  overflow-x: hidden; /* prevents accidental horizontal scroll from stray wide elements */
}

img, picture, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button, [type='button'], [type='submit'] {
  cursor: pointer;
}

ul, ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

body, h1, h2, h3, h4, h5, h6, p {
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
}

/* =============================================================
   THE CONTAINER — used by every page, every section.
   No page-specific CSS should redefine max-width/padding for its
   own ".container" — if a section needs to be narrower, nest an
   inner wrapper with its own max-width INSIDE this container,
   never replace it.
   ============================================================= */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--page-px);
}

/* Use when a section's content should read narrower than the full
   grid (e.g. long-form text, centered intros) — nest inside .container */
.container--narrow {
  max-width: 48rem;
  margin-inline: auto;
}

.container--medium {
  max-width: 64rem;
  margin-inline: auto;
}

.section {
  padding-block: var(--space-xl);
}

.grid-auto {
  display: grid;
  gap: var(--gutter);
}

.row--2 {
  display: grid;
  gap: var(--gutter);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .row--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.text-display-lg {
  font-size: clamp(3rem, 5vw, 4.5rem);
  line-height: 1.04;
  font-weight: 800;
  font-family: var(--font-family-display);
}

.text-display-lg-mobile {
  font-size: clamp(2.25rem, 7vw, 3.5rem);
  line-height: 1.05;
  font-weight: 800;
  font-family: var(--font-family-display);
}

.text-headline-lg {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.08;
  font-weight: 800;
  font-family: var(--font-family-display);
}

.text-copy {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-on-surface-variant);
}

.text-muted {
  color: rgba(12, 28, 20, 0.68);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-control);
  font-weight: 700;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.button--primary {
  min-inline-size: 12rem;
  background: var(--color-secondary);
  color: #fff;
  border: 1px solid transparent;
}

.button--primary:hover,
.button--primary:focus {
  opacity: 0.95;
  transform: translateY(-1px);
}

.button--secondary {
  background: var(--color-secondary);
  color: #fff;
  border: 1px solid transparent;
}

.button--secondary:hover,
.button--secondary:focus {
  opacity: 0.9;
  transform: translateY(-1px);
}

.button--outline {
  background: transparent;
  color: var(--color-secondary);
  border: 2px solid var(--color-secondary);
}

.button--outline:hover,
.button--outline:focus {
  background: var(--color-secondary);
  color: #fff;
}

.button--outline-light {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.button--outline-light:hover,
.button--outline-light:focus {
  background: rgba(255, 255, 255, 0.1);
}

.button--ghost {
  background: transparent;
  color: var(--color-on-surface);
  border: 1px solid rgba(12, 28, 20, 0.12);
}

.button--ghost:hover,
.button--ghost:focus {
  background: rgba(12, 28, 20, 0.04);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-pill);
  background: rgba(12, 28, 20, 0.05);
  border: 1px solid rgba(12, 28, 20, 0.08);
  font-size: 0.95rem;
  font-weight: 700;
}

.section--muted {
  background: var(--color-surface);
}

.section--dark {
  background: var(--color-ink-deep);
  color: var(--color-on-ink);
}

.section--dark a {
  color: var(--color-on-ink);
}

.stats-strip {
  padding-block: 3rem;
}

.stats-strip--dark {
  background: var(--color-ink);
  color: var(--color-on-ink);
}

.visually-hidden,
.is-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Form utilities */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-block-end: 1rem;
}

.form-control {
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(12, 28, 20, 0.12);
  background: #fff;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 2px rgba(3, 109, 54, 0.12);
}

textarea.form-control {
  resize: vertical;
}

select.form-control {
  appearance: none;
  cursor: pointer;
}

/* Alert utility */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-block-end: 1rem;
}

.alert--hidden {
  display: none;
}

.alert--success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert--error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Back-to-top button */
.btn-back-to-top {
  position: fixed;
  bottom: 1.5rem;
  inset-inline-end: 1.5rem;
  z-index: 40;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background: var(--color-secondary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.btn-back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.btn-back-to-top:hover {
  transform: translateY(-3px);
}

/* Prose content */
.prose {
  max-width: 65ch;
  line-height: 1.7;
  color: var(--color-on-surface-variant);
}

.prose h2, .prose h3, .prose h4 {
  color: var(--color-primary);
  font-weight: 700;
  margin-block: 1.5rem 0.5rem;
}

.prose p {
  margin-block-end: 1rem;
}

.prose ul, .prose ol {
  list-style: revert;
  padding-inline-start: 1.5rem;
  margin-block-end: 1rem;
}

.prose li {
  margin-block-end: 0.375rem;
}