/* ═══════════════════════════════════════════════════════════════════════
   WHALE Digital Platform — Design System
   design-system.css  |  v1.0.0
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 1. DESIGN TOKENS ─────────────────────────────────────────────────── */
:root {
  /* Brand Palette */
  --whale-navy:        #062f5f;
  --whale-navy-dark:   #041e3e;
  --whale-navy-mid:    #0d4a8a;
  --whale-blue:        #1687ed;
  --whale-blue-lt:     #48a7f5;
  --whale-cyan:        #37c9ed;
  --whale-cyan-lt:     #7de0f5;
  --whale-cyan-pale:   #dff6fd;
  --whale-green:       #2bd675;
  --whale-orange:      #ff9c22;

  /* Neutrals */
  --whale-ink:         #092650;
  --whale-muted:       #64708b;
  --whale-subtle:      #9daec7;
  --whale-soft:        #f4f9ff;
  --whale-line:        #dce8f4;
  --whale-white:       #ffffff;

  /* Semantic aliases */
  --c-primary:   var(--whale-blue);
  --c-secondary: var(--whale-navy);
  --c-accent:    var(--whale-cyan);
  --c-text:      var(--whale-ink);
  --c-muted:     var(--whale-muted);
  --c-bg:        var(--whale-white);
  --c-bg-soft:   var(--whale-soft);
  --c-border:    var(--whale-line);

  /* Typography */
  --f-ar:   'Alexandria', 'Segoe UI', Arial, sans-serif;
  --f-en:   'Manrope',    'Segoe UI', Arial, sans-serif;
  --f-body: var(--f-ar);

  /* Font Scale */
  --tx-xs:   0.6875rem;  /* 11px */
  --tx-sm:   0.8125rem;  /* 13px */
  --tx-base: 1rem;       /* 16px */
  --tx-lg:   1.125rem;   /* 18px */
  --tx-xl:   1.375rem;   /* 22px */
  --tx-2xl:  1.75rem;    /* 28px */
  --tx-3xl:  2.25rem;    /* 36px */
  --tx-4xl:  clamp(2rem, 4vw, 3.25rem);
  --tx-hero: clamp(2.5rem, 5.5vw, 4.5rem);

  /* Weights */
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semi:     600;
  --fw-bold:     700;
  --fw-black:    800;

  /* Line Heights */
  --lh-tight:   1.2;
  --lh-snug:    1.35;
  --lh-normal:  1.6;
  --lh-relaxed: 1.85;
  --lh-loose:   2.1;

  /* Spacing (4px base) */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;
  --sp-32: 8rem;

  /* Reading comfort */
  --prose-max:  72ch;    /* max line length for articles */
  --section-gap: var(--sp-24); /* uniform section spacing */

  /* Radius - Corporate Premium (smaller = more professional) */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-2xl:  20px;
  --r-3xl:  28px;
  --r-full: 9999px;

  /* Shadows */
  --sh-xs: 0 1px 4px  rgba(6,47,95,.04);
  --sh-sm: 0 4px 16px rgba(6,47,95,.07);
  --sh-md: 0 8px 32px rgba(6,47,95,.10);
  --sh-lg: 0 16px 56px rgba(6,47,95,.14);
  --sh-xl: 0 24px 80px rgba(6,47,95,.18);

  /* Container */
  --ctn-max: 1280px;
  --ctn-pad: clamp(20px, 5vw, 80px);

  /* Header */
  --hdr-h: 80px;

  /* Section */
  --sec-py: clamp(72px, 9vw, 128px);

  /* Z-Index */
  --z-float:  10;
  --z-nav:    50;
  --z-header: 100;
  --z-modal: 200;

  /* Easing */
  --ease:        cubic-bezier(.4,0,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --t-fast:      150ms var(--ease);
  --t-base:      250ms var(--ease);
  --t-slow:      400ms var(--ease);
  --t-spring:    500ms var(--ease-spring);
}

/* Premium accent for CTAs — electric blue with contrast guarantee */
:root {
  --c-cta:        #0066FF;   /* Primary CTA — high contrast */
  --c-cta-hover:  #0052CC;   /* Primary CTA hover */
  --c-cta-text:   #ffffff;   /* CTA text always white */
}

html[lang="en"] { --f-body: var(--f-en); }

/* ── 2. RESET ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: var(--tx-base);
  line-height: var(--lh-normal);
  color: var(--c-text);
  background: var(--c-bg);
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; padding: 0; font: inherit; }
ul, ol { list-style: none; margin: 0; padding: 0; }
p { margin: 0; }
h1,h2,h3,h4,h5,h6 { margin: 0; font-weight: var(--fw-black); line-height: var(--lh-tight); }
fieldset { border: none; padding: 0; margin: 0; }

/* ── 3. TYPOGRAPHY ────────────────────────────────────────────────────── */
.eyebrow {
  display: block;
  font-family: var(--f-en);
  font-size: var(--tx-xs);
  font-weight: var(--fw-black);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--whale-blue);
  margin-block-end: var(--sp-4);
}
.eyebrow--light { color: var(--whale-cyan-lt); }

.heading-hero {
  font-size: var(--tx-hero);
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  color: var(--whale-ink);
}
.heading-xl {
  font-size: var(--tx-4xl);
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  color: var(--whale-ink);
}
.heading-lg {
  font-size: var(--tx-3xl);
  font-weight: var(--fw-black);
  line-height: var(--lh-snug);
  letter-spacing: -0.01em;
  color: var(--whale-ink);
}
.heading-md {
  font-size: var(--tx-2xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--whale-ink);
}
.heading-sm {
  font-size: var(--tx-xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--whale-ink);
}

.text-lead {
  font-size: var(--tx-lg);
  line-height: var(--lh-relaxed);
  color: var(--whale-muted);
}
.text-body { font-size: var(--tx-base); line-height: var(--lh-loose); color: var(--whale-muted); }
.text-sm   { font-size: var(--tx-sm); line-height: var(--lh-relaxed); }
.text-xs   { font-size: var(--tx-xs); }

.text-white  { color: var(--whale-white); }
.text-navy   { color: var(--whale-navy); }
.text-blue   { color: var(--whale-blue); }
.text-cyan   { color: var(--whale-cyan); }
.text-muted  { color: var(--whale-muted); }
.text-ink    { color: var(--whale-ink); }

em.highlight { font-style: normal; color: var(--whale-blue); }
em.highlight--cyan { font-style: normal; color: var(--whale-cyan); }

/* ── 4. LAYOUT ────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--ctn-max);
  margin-inline: auto;
  padding-inline: var(--ctn-pad);
}
.container--narrow { max-width: 860px; }
.container--wide   { max-width: 1440px; }

.section {
  padding-block: var(--sec-py);
}
.section--soft   { background: var(--whale-soft); }
.section--navy   { background: var(--whale-navy); color: var(--whale-white); }
.section--dark   { background: var(--whale-navy-dark); color: var(--whale-white); }
.section--white  { background: var(--whale-white); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-8);
  margin-block-end: var(--sp-12);
}
.section-head--center {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-6); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--sp-5); }

/* Flex helpers */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.flex-gap-4  { gap: var(--sp-4); }
.flex-gap-6  { gap: var(--sp-6); }
.flex-wrap   { flex-wrap: wrap; }

/* Spacers */
.mt-4  { margin-block-start: var(--sp-4); }
.mt-6  { margin-block-start: var(--sp-6); }
.mt-8  { margin-block-start: var(--sp-8); }
.mt-10 { margin-block-start: var(--sp-10); }
.mt-12 { margin-block-start: var(--sp-12); }
.mb-4  { margin-block-end: var(--sp-4); }
.mb-6  { margin-block-end: var(--sp-6); }
.mb-8  { margin-block-end: var(--sp-8); }

/* ── 5. UTILITY ───────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rounded     { border-radius: var(--r-md); }
.rounded-lg  { border-radius: var(--r-lg); }
.rounded-xl  { border-radius: var(--r-xl); }
.rounded-2xl { border-radius: var(--r-2xl); }
.rounded-3xl { border-radius: var(--r-3xl); }
.rounded-full{ border-radius: var(--r-full); }

.animate-fade-in  { animation: fadeIn  .6s var(--ease) both; }
.animate-slide-up { animation: slideUp .6s var(--ease) both; }
.animate-scale-in { animation: scaleIn .5s var(--ease-spring) both; }

/* Scroll animations — elements visible by default; JS adds .js-ready to body */
[data-animate] { opacity: 1; transform: none; }
.js-ready [data-animate] { opacity: 0; transform: translateY(20px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.js-ready [data-animate].in-view { opacity: 1; transform: none; }
.js-ready [data-animate][data-delay="100"] { transition-delay: .1s; }
.js-ready [data-animate][data-delay="200"] { transition-delay: .2s; }
.js-ready [data-animate][data-delay="300"] { transition-delay: .3s; }
.js-ready [data-animate][data-delay="400"] { transition-delay: .4s; }
.js-ready [data-animate][data-delay="500"] { transition-delay: .5s; }

/* ── 6. KEYFRAMES ─────────────────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity:0 } to { opacity:1 } }
@keyframes slideUp { from { opacity:0; transform:translateY(28px) } to { opacity:1; transform:none } }
@keyframes scaleIn { from { opacity:0; transform:scale(.92) } to { opacity:1; transform:none } }
@keyframes float   {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes floatSlow {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-14px) rotate(2deg); }
}
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes spin-rev { to { transform: rotate(-360deg); } }
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(55,201,237,.4); }
  50%       { box-shadow: 0 0 0 20px rgba(55,201,237,.0); }
}
@keyframes count-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── 7. RESPONSIVE BREAKPOINTS ────────────────────────────────────────── */
/* xs: < 480  sm: ≥ 480  md: ≥ 768  lg: ≥ 1024  xl: ≥ 1280 */
@media (max-width: 767px) {
  :root { --sec-py: clamp(48px, 8vw, 80px); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; }
}
@media (min-width: 480px) and (max-width: 767px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1023px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ── 8. ACCESSIBILITY, ARABIC TYPOGRAPHY & UX OVERRIDES ── */

/* Prevent Arabic Tashkeel/diacritics clipping by ensuring line-height is at least 1.45 */
html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] h4,
html[lang="ar"] h5,
html[lang="ar"] h6,
html[lang="ar"] .heading-hero,
html[lang="ar"] .heading-xl,
html[lang="ar"] .heading-lg,
html[lang="ar"] .heading-md {
  line-height: 1.45 !important;
  text-wrap: balance; /* Prevent widows */
}

/* Focus ring replacement instead of outline-none */
*:focus-visible {
  outline: 2px solid var(--whale-cyan) !important;
  outline-offset: 4px;
}

/* Composite friendly layers */
.wa-float, .cursor-dot, .cursor-ring, .site-header {
  will-change: transform;
}

/* Explicit spacing overrides for English (LTR) pages to prevent word-collapsing bugs in Chrome */
html[lang="en"] .heading-hero,
html[lang="en"] .heading-xl,
html[lang="en"] .heading-lg,
html[lang="en"] .heading-md,
html[lang="en"] h1,
html[lang="en"] h2,
html[lang="en"] h3 {
  letter-spacing: 0.2px !important;
  word-spacing: 1px !important;
}
