/* ==========================================================================
   Yoosl — Reset, document defaults, typography, layout primitives  (RTL-first)
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-p4);
  font-weight: var(--fw-regular);
  line-height: var(--lh-tight);
  color: var(--text-body);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* The document is RTL (dir="rtl" on <html>). Latin runs inside Arabic text are
   handled by the bidi algorithm; `.ltr` forces direction where needed. */
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }

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

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

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

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

:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--primary-500); color: var(--white); }

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--text-strong);
  text-wrap: balance;
}

h1, .h1 { font-size: var(--fs-h1); }
h2, .h2 { font-size: var(--fs-h2); }
h3, .h3 { font-size: var(--fs-h3); }
h4, .h4 { font-size: var(--fs-h4); }

.display { font-family: var(--font-display); font-weight: var(--fw-bold); }

/* .lead comes before the type-scale utilities so that a `lead p2` pairing
   takes the P2 style (24px / 1.4, as Figma sets it) rather than the lead's
   own 20px / 1.6. The utilities state Figma's 1.4 for that reason. */
.lead {
  font-size: var(--fs-p3);
  color: var(--text-muted);
  line-height: 1.6;
  text-wrap: pretty;
}

.p2 { font-size: var(--fs-p2); line-height: var(--lh-tight); }
.p3 { font-size: var(--fs-p3); line-height: var(--lh-tight); }
.p4 { font-size: var(--fs-p4); line-height: var(--lh-tight); }
.p5 { font-size: var(--fs-p5); line-height: var(--lh-tight); }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.accent { color: var(--primary-500); }
.on-dark { color: var(--text-on-dark); }
.cream { color: var(--secondary-500); }

p { text-wrap: pretty; }

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * .6); }
.section--cream { background: var(--surface-cream); }
.section--dark { background: var(--surface-dark); color: var(--text-on-dark); }
.section--alt { background: var(--surface-alt); }

.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: var(--secondary-500); }

.stack { display: flex; flex-direction: column; }
.stack--2 { gap: var(--sp-2); }
.stack--3 { gap: var(--sp-3); }
.stack--4 { gap: var(--sp-4); }
.stack--6 { gap: var(--sp-6); }
.stack--8 { gap: var(--sp-8); }
.stack--12 { gap: var(--sp-12); }

.row { display: flex; align-items: center; gap: var(--sp-4); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }

.grid { display: grid; gap: var(--sp-6); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 960px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
}

/* Section heading block — right-aligned title + supporting line (RTL) */
.section-head { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 56ch; }
.section-head--center { margin-inline: auto; text-align: center; align-items: center; }
.section-head--end { margin-inline-start: auto; text-align: end; }

/* Eyebrow / small caps label */
.eyebrow {
  font-size: var(--fs-p4);
  font-weight: var(--fw-bold);
  color: var(--primary-500);
  letter-spacing: .02em;
}

/* Utilities */
.center { text-align: center; }
.end { text-align: end; }
.full { width: 100%; }
.relative { position: relative; }
.hidden { display: none !important; }

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

.skip-link {
  position: absolute; inset-inline-start: 50%; top: 0;
  transform: translate(50%, -120%);
  z-index: 200;
  background: var(--primary-500); color: var(--white);
  padding: var(--sp-3) var(--sp-5);
  border-radius: 0 0 var(--r-md) var(--r-md);
  font-weight: var(--fw-bold);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus { transform: translate(50%, 0); }
