/* ==========================================================================
   Muzamna Technical Solutions — Design Tokens
   ========================================================================== */

:root {
  /* Brand */
  --contrast:    #222222;
  --contrast-2:  #A63C81;
  --contrast-3:  #AE93BF;
  --base:        #D1C5D9;
  --base-2:      #F8FAFC;
  --base-3:      #FFFFFF;
  --accent:      #4E1773;

  /* Derived */
  --ink:         var(--contrast);
  --ink-soft:    #4A4550;
  --ink-muted:   #7A7380;
  --paper:       var(--base-3);
  --paper-soft:  var(--base-2);
  --panel:       #FAF7FB;
  --line:        #EDE6F0;
  --line-strong: #D9CEE0;

  /* Semantic */
  --bg:          var(--paper);
  --bg-soft:     var(--paper-soft);
  --fg:          var(--ink);
  --fg-soft:     var(--ink-soft);
  --fg-muted:    var(--ink-muted);

  /* Type */
  --ff-ar-display: 'Alexandria', system-ui, sans-serif;
  --ff-ar-body:    'Alexandria', system-ui, sans-serif;
  --ff-en-display: 'Alexandria', system-ui, sans-serif;
  --ff-en-body:    'Alexandria', system-ui, sans-serif;
  --ff-mono:       'Alexandria', system-ui, sans-serif;
  --ff-accent:     'Instrument Serif', 'Times New Roman', serif;

  /* Type scale
   * Modular ratio ~1.22 (perfect-fourth-ish). Each step grows ~22%.
   *  step--1  14    → 15.2  (mono labels, eyebrows, meta)
   *  step-0   16    → 18    (body, buttons, descriptions)
   *  step-1   19    → 22    (lede, principle title, post excerpt)
   *  step-2   23    → 28    (sub-headings, post title, contact email)
   *  step-3   28    → 36    (card titles — service, case, article body h2)
   *  step-4   36    → 50    (hero stat numbers, contact CTA email)
   *  step-5   44    → 68    (.sec-title — homepage section headlines)
   *  step-6   56    → 96    (hero h1, contact headline, megatype)
   * All values readable at ≥360px viewport, comfortable at ≥1440px. */
  --step--1: clamp(0.875rem, 0.84rem + 0.18vw, 0.95rem);
  --step-0:  clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --step-1:  clamp(1.1875rem, 1.13rem + 0.3vw, 1.375rem);
  --step-2:  clamp(1.4375rem, 1.31rem + 0.6vw, 1.75rem);
  --step-3:  clamp(1.75rem,   1.55rem + 1vw,   2.25rem);
  --step-4:  clamp(2.25rem,   1.9rem + 1.6vw,  3.125rem);
  --step-5:  clamp(2.75rem,   2.25rem + 2.5vw, 4.25rem);
  --step-6:  clamp(3.5rem,    2.6rem + 4vw,    6rem);

  /* Layout */
  --max:      1360px;
  --gutter:   clamp(20px, 4vw, 56px);
  --radius:   4px;
  --radius-lg: 14px;

  /* WordPress chrome */
  --wp-admin-bar-offset: 0px;

  /* Motion */
  --ease: cubic-bezier(.2,.7,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

/* Dark theme */
:root[data-theme="dark"] {
  --bg:          #141014;
  --bg-soft:     #1A151C;
  --paper:       #141014;
  --paper-soft:  #1A151C;
  --panel:       #201829;
  --fg:          #F2ECF4;
  --fg-soft:     #BFB3C6;
  --fg-muted:    #8A7F92;
  --line:        #2A2130;
  --line-strong: #3B2F44;
  --accent:      #C89BE6;
  --contrast-2:  #E9A5CD;
}

/* Density tweak */
:root[data-density="compact"] { --gutter: clamp(16px, 3vw, 40px); }
:root[data-density="airy"]    { --gutter: clamp(28px, 5.5vw, 80px); }

body.admin-bar { --wp-admin-bar-offset: 32px; }
@media screen and (max-width: 782px) {
  body.admin-bar { --wp-admin-bar-offset: 46px; }
}
@media screen and (max-width: 600px) {
  body.admin-bar { --wp-admin-bar-offset: 0px; }
}

/* ==========================================================================
   Reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--ff-ar-body);
  font-size: var(--step-0);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
:root[lang="en"] body { font-family: var(--ff-en-body); }

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: #fff; }

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ==========================================================================
   Utilities
   ========================================================================== */
/* Screen-reader utility */
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.screen-reader-text:focus {
  width: auto;
  height: auto;
  clip: auto;
  z-index: 9999;
  inset-inline-start: var(--gutter);
  inset-block-start: calc(var(--wp-admin-bar-offset, 0px) + 12px);
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.eyebrow {
  font-family: var(--ff-mono);
  font-size: var(--step--1);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent);
}
:root[lang="ar"] .eyebrow { font-family: var(--ff-mono); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-family: var(--ff-ar-body);
  font-weight: 500;
  font-size: var(--step-0);
  transition: transform .3s var(--ease), background .3s var(--ease), color .3s var(--ease);
  white-space: nowrap;
  cursor: pointer;
}
:root[lang="en"] .btn { font-family: var(--ff-en-body); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--contrast); transform: translateY(-1px); }
.btn--ghost { color: var(--fg); border: 1px solid var(--line-strong); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 16px; height: 16px; }

/* Arrow helper — flips in RTL */
:root[dir="rtl"] .arrow-x, :root[lang="ar"] .arrow-x { transform: scaleX(-1); }

/* ==========================================================================
   Section scaffolding
   ========================================================================== */
section { position: relative; }
.sec-pad { padding-block: clamp(60px, 7vw, 120px); }
.sec-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: clamp(20px, 4vw, 64px);
  align-items: end;
  margin-bottom: clamp(32px, 5vw, 68px);
}
@media (max-width: 800px) { .sec-head { grid-template-columns: 1fr; } }

.sec-title {
  font-family: var(--ff-ar-display);
  font-weight: 500;
  font-size: var(--step-5);
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: 14px 0 0;
  text-wrap: balance;
}
:root[lang="en"] .sec-title {
  font-family: var(--ff-en-display);
  font-weight: 600;
  letter-spacing: -.02em;
}
.sec-lede {
  font-size: var(--step-1);
  color: var(--fg-soft);
  line-height: 1.5;
  max-width: 52ch;
  text-wrap: pretty;
}

/* Hide opposite language */
:root[lang="ar"] [data-lang="en"] { display: none !important; }
:root[lang="en"] [data-lang="ar"] { display: none !important; }

/* RTL / LTR switching */
:root[lang="ar"] { direction: rtl; }
:root[lang="en"] { direction: ltr; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* Divider ribbon — signature motif */
.ribbon-div {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: .5;
  margin-block: 12px;
}
.ribbon-div span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.ribbon-div span:nth-child(1) { opacity: .3; }
.ribbon-div span:nth-child(2) { opacity: .6; }
.ribbon-div span:nth-child(3) { opacity: 1; }
.ribbon-div span:nth-child(4) { opacity: .6; }
.ribbon-div span:nth-child(5) { opacity: .3; }

/* ==========================================================================
   Performance — offscreen rendering
   Skip rendering below-fold sections until they enter the viewport.
   Reserves estimated height via contain-intrinsic-size so anchor jumps
   and scrollbar dimensions stay accurate.
   ========================================================================== */
.services,
.process,
.work,
.about,
.team,
.clients,
.testimonials,
.insights,
.careers,
.contact {
  content-visibility: auto;
  contain-intrinsic-size: 1px 1100px;
}
/* Hero stays fully rendered — it is the LCP block. */
.hero { content-visibility: visible; }
