/* ==========================================================================
   duyufajwa — Base
   Reset · Arabic-first typography · RTL layout · accessibility · primitives
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

/* Author `display` rules (e.g. .field { display:flex }) would otherwise
   defeat the UA's [hidden] rule. JS toggles `hidden` on whole fields. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  /* Anchor links must clear the sticky header. Logical property so it works
     in RTL without a second rule. */
  scroll-padding-block-start: calc(var(--header-h) + var(--sp-4));
}

body {
  min-height: 100dvh;
  min-height: 100vi;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-lg);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  /* Arabic: never tracked. Enforced on the root so no component can
     accidentally inherit a Latin design-system default. */
  letter-spacing: var(--ls-arabic);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
  overscroll-behavior-y: none;
}

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

img,
video {
  height: auto;
  /* Reserve layout space so nothing shifts while images load. */
  background-color: var(--media-bg);
}

input,
button,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  -webkit-tap-highlight-color: transparent;
}

select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 1rem center;
  background-size: 1rem 1rem;
  padding-left: 2.75rem;
  padding-right: 1.25rem;
  padding-block: 0.5rem;
}
[dir="ltr"] select {
  background-position: right 1rem center;
  padding-left: 1.25rem;
  padding-right: 2.75rem;
}

button,
.btn,
.icon-btn,
.tab {
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* The original site needed `overflow-x: clip` on html+body to hide overflow
   it could not fix. That band-aid is deliberately absent here. If overflow
   appears, the layout is wrong and gets fixed at the source. */

/* --------------------------------------------------------------------------
   2. Arabic typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-weight: var(--fw-heavy);
  color: var(--brand);
  /* Display floor of 1.35. The original ran these at 1.14–1.28, which
     left ~7px of leading for Arabic diacritics at 54px. */
  line-height: var(--lh-display);
  letter-spacing: var(--ls-arabic);
  text-wrap: balance;
  margin-block-end: var(--sp-3);
}

h1 {
  font-size: var(--fs-d1);
  font-weight: var(--fw-black);
}
h2 {
  font-size: var(--fs-d2);
}
h3 {
  font-size: var(--fs-d3);
  font-weight: var(--fw-bold);
}
h4 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
}

p {
  text-wrap: pretty;
  margin-block-end: var(--sp-4);
}
p:last-child {
  margin-block-end: 0;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: color var(--dur-1) var(--ease);
}
a:hover {
  color: var(--accent-hover);
}

strong,
b {
  font-weight: var(--fw-bold);
}

small {
  font-size: var(--fs-sm);
}

ul,
ol {
  padding-inline-start: 1.25em;
}

/* Latin fragments embedded inside Arabic sentences. Without isolation the
   bidi algorithm reorders adjacent punctuation and the sentence reads wrong. */
.ltr {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
}

/* Phone numbers, prices in Latin digits, codes, URLs. */
.num {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Phone number formatted correctly in RTL environments */
.phone-number {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Never allow a Latin word to sit directly after the Arabic article prefix
   الـ — the detached letters jump to the wrong side. Rephrase instead. */

/* --------------------------------------------------------------------------
   3. Focus + accessibility
   -------------------------------------------------------------------------- */
:focus {
  outline: none;
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-xs);
}

::selection {
  background: var(--y-200);
  color: var(--n-950);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-block-start: var(--sp-3);
  inset-inline-start: var(--sp-3);
  z-index: 200;
  padding: var(--sp-3) var(--sp-4);
  background: var(--brand);
  color: var(--text-inverse);
  border-radius: var(--r-sm);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur-2) var(--ease);
}
.skip-link:focus-visible {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */
.container {
  width: min(var(--w-container), 100% - (var(--gutter) * 2));
  margin-inline: auto;
}
.container--wide {
  width: min(var(--w-wide), 100% - (var(--gutter) * 2));
}
.container--content {
  width: min(var(--w-content), 100% - (var(--gutter) * 2));
  margin-inline: auto;
}
.container--narrow {
  width: min(var(--w-narrow), 100% - (var(--gutter) * 2));
  margin-inline: auto;
}

.section {
  padding-block: clamp(var(--sp-7), 7vw, var(--sp-9));
}
.section--tight {
  padding-block: clamp(var(--sp-6), 5vw, var(--sp-7));
}
.section--alt {
  background: var(--bg-alt);
}
.section--brand {
  background: var(--surface-brand);
  color: var(--text-inverse);
}
.section--brand h1,
.section--brand h2,
.section--brand h3 {
  color: var(--text-inverse);
}

.stack > * + * {
  margin-block-start: var(--sp-4);
}
.stack-lg > * + * {
  margin-block-start: var(--sp-6);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}

.section-head {
  max-width: 46ch;
  margin-block-end: var(--sp-6);
}
.section-head--center {
  margin-inline: auto;
  text-align: center;
}

/* The section eyebrow. The original applied letter-spacing: .08em to this
   on Arabic text, which pulled apart letters that must join. Tracking is
   gone; hierarchy now comes from weight, colour and a rule. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-block-end: var(--sp-3);
  color: var(--y-800);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-arabic);
  text-transform: none;
}
.eyebrow::before {
  content: "";
  inline-size: 1.75rem;
  block-size: 2px;
  background: var(--accent);
  border-radius: var(--r-pill);
}
.eyebrow--plain::before {
  display: none;
}
.section--brand .eyebrow {
  color: var(--y-300);
}

.lede {
  font-size: var(--fs-xl);
  line-height: 1.65;
  color: var(--text-soft);
  max-width: 60ch;
}

.muted {
  color: var(--text-muted);
}
.prose {
  max-width: 68ch;
}
.prose p {
  margin-block-end: var(--sp-4);
}

/* --------------------------------------------------------------------------
   5. Utilities
   -------------------------------------------------------------------------- */
.hr {
  block-size: 1px;
  border: 0;
  background: var(--line);
  margin-block: var(--sp-6);
}

/* A hairline that fades at both ends — used instead of a hard rule between
   sections on the cream ground. */
.hr--fade {
  background: linear-gradient(
    to var(--dir-end, left),
    transparent,
    var(--line) 20%,
    var(--line) 80%,
    transparent
  );
}

/* Screen reader only 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;
}

