/* ============================================================
   Webify Component Library — Base & Layout Primitives
   Uses CSS logical properties throughout so LTR/RTL share
   one codebase. See rtl.css only for the few things that
   cannot be expressed logically (icon/gradient direction).
   ============================================================ */

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--text-body);
  background: var(--surface);
}

/* Arabic typography — applied when <html dir="rtl"> */
[dir="rtl"] body { font-family: var(--font-arabic); }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3,
[dir="rtl"] h4, [dir="rtl"] .btn { font-family: var(--font-arabic); }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text-strong);
  letter-spacing: var(--tracking-tight);
  font-weight: 700;
}
/* Bare tags take the ROLE, not a raw scale step. h2 was --fs-3xl (52px),
   which is why about/ and the case study -- the two pages whose body
   headings are still bare tags -- outranked the shared .section__title
   by 16px. */
/* The page role carries tracking and leading too, or a bare <h1> (about/,
   404) sits at the same 62.4px as every classed H1 but with the general
   --tracking-tight and default leading -- the exact drift the role token
   exists to close. RTL overrides both in webify.css. */
h1 {
  font-size: var(--h-page);
  line-height: var(--h-page-leading);
  letter-spacing: var(--h-page-track);
}
h2 { font-size: var(--h-section); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
p  { color: var(--text-body); }
/* One link-hover colour, from a token, so a page cannot invent its own.
   --brand-accent (#C9A227) only reaches ~2.4:1 on white; --link-hover
   resolves to --brand-accent-dark, which clears AA on both white and
   --ground-tint. Dark grounds use --link-hover-on-dark. */
/* `:not(.btn)` on all three: these are PROSE link rules, but the two
   section-scoped ones land at (0,2,1) and so outranked every button's
   own hover, which is only (0,2,0). A filled CTA therefore threw away
   the label colour it had just set and took the prose gold instead:
   .btn--secondary (blue #0300A9, white label) went to #8F7115 on
   #3A2FD9 -- 1.75:1, versus 8.1:1 for the white it was meant to keep --
   and .btn--primary in an inverse band went to #E0BC45 on a #E0BC45
   hover background, i.e. the label disappeared completely. Buttons own
   their hover colour; prose links keep theirs. */
a:not(.btn):hover { color: var(--link-hover); }
:is(.section--muted, .section--tint) a:not(.btn):hover { color: var(--link-hover-on-tint); }
.section--inverse a:not(.btn):hover { color: var(--link-hover-on-dark); }
strong { color: var(--text-strong); font-weight: 600; }

/* ---- Layout primitives ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
.section { padding-block: clamp(3rem, 8vw, var(--space-4xl)); }
.section--muted { background: var(--surface-muted); }
.section--inverse {
  background: var(--surface-inverse);
  color: var(--color-gray-200);
}
.section--inverse h2, .section--inverse h3 { color: var(--color-white); }

.section__head {
  max-width: 46rem;
  margin-inline: auto;
  margin-block-end: var(--space-2xl);
  text-align: center;
}
.section__eyebrow {
  display: inline-block;
  font-size: var(--kicker-size);
  font-weight: var(--kicker-weight);
  letter-spacing: var(--kicker-track);
  text-transform: uppercase;
  color: var(--kicker-color);
  margin-block-end: var(--space-xs);
}
.section--inverse .section__eyebrow { color: var(--kicker-color-on-dark); }
.section__title { font-size: var(--h-section); }
.section__subtitle {
  margin-block-start: var(--space-sm);
  font-size: var(--fs-lg);
  color: var(--text-muted);
}

.grid { display: grid; gap: var(--space-lg); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.8em 1.6em;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--fs-base);
  line-height: 1.1;
  border-radius: var(--radius-full);
  transition: transform var(--transition-fast), box-shadow var(--transition-base), background var(--transition-base);
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  box-shadow: var(--shadow-accent);
}
.btn--primary:hover { background: var(--brand-accent-light); color: var(--brand-on-accent); }
.btn--secondary {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
}
.btn--secondary:hover { background: var(--brand-primary-light); color: var(--brand-on-primary); }
.btn--ghost {
  background: transparent;
  color: var(--brand-primary);
  box-shadow: inset 0 0 0 2px var(--border);
}
/* The border may be the bright accent; the TEXT may not -- #C9A227 on
   white is ~2.4:1. Same gold family, one step down, AA on white. */
.btn--ghost:hover,
.btn--ghost:focus-visible { box-shadow: inset 0 0 0 2px var(--brand-accent); color: var(--brand-accent-dark); }
.btn--lg { font-size: var(--fs-lg); padding: 0.95em 2em; }
.btn--block { width: 100%; }
.btn__icon { width: 1.1em; height: 1.1em; }

/* Chips / pills */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 0.3em 0.85em;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--brand-accent) 14%, var(--surface));
  color: var(--brand-accent-dark);
}

/* Reveal-on-scroll (progressive; JS adds .is-visible) */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* Utilities */
.text-center { text-align: center; }
.mt-lg { margin-block-start: var(--space-lg); }
.stack > * + * { margin-block-start: var(--space-md); }
