/* ===========================================================================
   Kyan Althiqah - design tokens

   One place for every colour, measure, weight and curve. Nothing in
   main.css states a raw hex or a raw millisecond; it reads a token from
   here. Changing the site's direction means changing this file, not
   hunting through two thousand lines of rules.

   Contrast is measured, never judged by eye. Every foreground/background
   pair used on the site is checked by tools/contrast.py, which prints the
   ratio and the WCAG grade. The numbers in the comments below came out of
   that script; re-run it before altering any of them.
   ========================================================================= */

:root {
  /* --- ink ------------------------------------------------------------
     The dark is a deep teal-navy rather than black. Pure black against
     warm paper reads as a printout; this is the colour of a good ink on
     a good page, and it is a darkened relative of the logo's teal, so
     the mark sits in the palette instead of on top of it. */
  /* Text ink. Lightened from #0E2A33, which measured 13.57:1 on paper
     and read as too heavy at display size. This is 9.84:1, still well
     past AAA's 7:1, so nothing is at risk; the page just stops being
     printed in near black. */
  --ink:            #1E4150;
  /* The same colour at its original strength, for the places --ink was
     doing a second job as a dark SURFACE rather than as text: the
     footer, the skip link, the burger bars, the inverted hovers.
     Those must not drift when the text colour is tuned, which is
     exactly what would have happened had this stayed one token. */
  --ink-surface:    #0E2A33;
  --ink-soft:       #1B3D49;
  --ink-mute:       #5A6E77;   /* measured 4.82:1 on paper, body-safe */
  --ink-faint:      #798B93;   /* measured 3.20:1, large or decorative only */
  /* The hero lead sits on the light wash, not on bare paper. Measured
     with the copy hidden and the field blurred past the thin elements,
     the ground under it is #D8C9AE, where this reads 4.60:1 and plain
     --ink-mute would read about 3.44:1, well under AA. On plain paper it is
     6.76:1, and against the h1 only 2.01:1, so it stays visibly the
     lighter of the two.

     **The headroom is now spent.** This number has tracked every pass
     over art-light.svg: 4.61, 5.77, 5.51, 5.16, now 4.60 against a
     floor of 4.5. The next time that gradient is darkened at all, this
     colour has to be darkened in the same edit, not afterwards. Run
     tools/measure-leading.py's sibling check, the blurred-field read in
     the notes above, before and after. */
  --ink-on-art:     #48575F;

  /* --- paper ---------------------------------------------------------- */
  --paper:          #F6F3ED;   /* warm, the page itself */
  --paper-lift:     #FBFAF7;   /* cards sitting on paper */
  --paper-pure:     #FFFFFF;
  --paper-sink:     #EDE8DF;   /* recessed bands */
  /* The ground both cards in the contact section sit on. They used to
     differ: the form was --paper-lift and the details card a 55% wash of
     it, so two things side by side at the same elevation were two
     colours. This is what that wash rendered as, stated once as a solid
     value so it cannot drift and so tools/contrast.py can resolve it. */
  --paper-card:     #F9F7F2;
  /* Form fields. Pure white was the one cold surface on a page built out
     of warm paper, but the first beige went too far the other way and
     read as dirty rather than warm. Measured as red minus blue, white
     is 0, the first attempt was 14, this is 10: still clearly not
     white, and only a shade below the card it sits in. Typed text on it
     is 10.27:1. */
  --paper-field:    #FBF8F1;

  /* Cards. The owner found white-washed cards too stark against the warm
     paper, so a card is a cream half way between --paper and --brass-wash:
     it reads as the same stock, a shade warmer, held off the page by its
     border and shadow rather than by brightness. */
  --card:           #F4EEE4;

  /* --- brand ----------------------------------------------------------
     Sampled off the logo PNG by pixel count, not guessed: the teal
     clusters between #3888A0 and #408098. --brand is that colour; the
     deep variant exists because the sampled teal measures only 3.83:1 on
     paper and cannot carry body text on its own. --brand-deep is 5.49:1. */
  --brand:          #38849C;
  --brand-deep:     #256A80;   /* measured 5.49:1 on paper, links and small text */
  --brand-dark:     #1B4E5F;
  --brand-wash:     #E6EFF2;
  --brand-line:     #C9DDE3;

  /* --- accent ---------------------------------------------------------
     A single restrained brass, used only for the seal, the chapter
     numbers and the rule that marks a live section. A notary's colour.
     At 3.45:1 on paper it is cleared for 24px+ only, never body copy. */
  --brass:          #A9793F;
  --brass-soft:     #C9A575;
  --brass-wash:     #F2E9DC;

  /* --- state ----------------------------------------------------------- */
  --ok:             #2F6B4F;
  --bad:            #A03A3A;

  /* --- semantic -------------------------------------------------------- */
  --bg:             var(--paper);
  --fg:             var(--ink);
  --fg-soft:        var(--ink-mute);
  --rule:           rgba(14, 42, 51, 0.13);
  --rule-soft:      rgba(14, 42, 51, 0.07);
  --rule-strong:    rgba(14, 42, 51, 0.24);

  /* --- type -----------------------------------------------------------
     One family across both scripts. IBM Plex Sans Arabic carries a real
     Latin companion drawn on the same skeleton, so the Arabic and the
     English pages look like the same publication rather than two sites
     that happen to share a logo. */
  --font: 'IBM Plex Sans Arabic', 'IBM Plex Sans', -apple-system,
          BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-num: var(--font);

  --w-light:   300;
  --w-reg:     400;
  --w-med:     500;
  --w-semi:    600;
  --w-bold:    700;

  /* A fifth-based scale, clamped so the phone never gets a headline it
     has to scroll sideways to read. Mobile is the priority surface. */
  --t-hero:   clamp(2.25rem, 1.35rem + 4.1vw, 4.75rem);
  --t-h2:     clamp(1.65rem, 1.18rem + 2.1vw, 3rem);
  --t-h3:     clamp(1.2rem,  1.04rem + 0.72vw, 1.6rem);
  --t-lead:   clamp(1.06rem, 0.98rem + 0.4vw,  1.28rem);
  --t-body:   clamp(1rem,    0.96rem + 0.2vw,  1.09rem);
  --t-small:  0.875rem;
  --t-micro:  0.75rem;

  /* Arabic leading is set from measured ink, not taste.
     `tools/measure-leading.py` reads actualBoundingBox{Ascent,Descent}
     from the site's own faces, for the site's own strings. Measured
     2026-09-17, in em, as descent(upper line) + ascent(lower line):

       hero h1        1.190   worst line نقدم خدمات للأفراد والمنشآت
       section h2     1.375   worst line موثقون مرخصون، في أنحاء المملكة
       service name   1.256   worst line الرهن العقاري وفكه
       footer word    0.967   كيان الثقة

     The h2 sat at 1.36 against a 1.375 requirement, which is a
     collision, not a near miss: ـق and ـه in "موثقون مرخصون" drop 0.45em
     below the baseline while the next line's alif-lam reaches 0.925em
     up. Re-run the tool after any heading copy change. Latin has no
     such problem and runs far tighter. */
  --lh-hero-ar: 1.26;
  --lh-hero-en: 1.08;
  --lh-h2-ar:   1.44;
  --lh-h2-en:   1.14;
  --lh-body-ar: 1.85;
  --lh-body-en: 1.65;

  --track-tight: -0.02em;
  --track-wide:   0.12em;
  --track-label:  0.18em;

  /* --- measure --------------------------------------------------------- */
  --wrap:       76rem;
  --wrap-text:  46rem;
  --gutter:     clamp(1.25rem, 0.85rem + 2vw, 3.5rem);
  --sec-y:      clamp(4.5rem, 3rem + 7vw, 9.5rem);

  --s-1:  0.25rem;
  --s-2:  0.5rem;
  --s-3:  0.75rem;
  --s-4:  1rem;
  --s-5:  1.5rem;
  --s-6:  2rem;
  --s-7:  3rem;
  --s-8:  4rem;
  --s-9:  6rem;

  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  14px;
  --r-pill: 999px;

  /* --- motion ----------------------------------------------------------
     Nothing on this site changes size on hover or on tap, by standing
     instruction. These curves drive fades, clips and colour only. */
  --e-out:  cubic-bezier(0.22, 0.61, 0.36, 1);
  --e-soft: cubic-bezier(0.33, 0, 0.1, 1);
  --d-fast: 160ms;
  --d-mid:  320ms;
  --d-slow: 640ms;

  /* --- depth -----------------------------------------------------------
     Shadows are close to the surface and cool, so cards read as paper
     lifted a millimetre rather than as floating widgets. */
  --lift-1: 0 1px 2px rgba(14, 42, 51, 0.05);
  --lift-2: 0 2px 8px rgba(14, 42, 51, 0.06), 0 1px 2px rgba(14, 42, 51, 0.04);
  --lift-3: 0 12px 32px rgba(14, 42, 51, 0.09), 0 2px 6px rgba(14, 42, 51, 0.05);

  --hdr-h: 4.5rem;

  /* the inline logo reads these two */
  --logo-teal: var(--brand);
  /* The K's stem is a neutral grey on the owner's banner, sampled at
     #898989. --ink-mute is a blue-grey and made the mark read as a
     different logo, so the grey is stated as the artwork has it. */
  --logo-grey: #898989;
}

@media (min-width: 900px) {
  :root { --hdr-h: 5.25rem; }
}
