/* ==========================================================================
   Cross Kashmir — Design tokens
   The ONLY place raw colour values and scale values should live.
   Everything else in /css consumes these variables.

   Breakpoints (CSS variables cannot be used inside @media, so they are
   documented here and repeated literally in the stylesheets):
     base   : < 640px   (mobile-first, no query)
     sm     : 640px
     md     : 768px
     lg     : 1024px
     xl     : 1280px
   ========================================================================== */

:root {
  /* ---- Colour: palette --------------------------------------------------- */
  --color-primary:       #174A3A;
  --color-primary-dark:  #10372B;
  --color-primary-light: #EAF1ED;
  --color-accent:        #C79A3B;
  --color-bg:            #F8F7F3;
  --color-surface:       #FFFFFF;
  --color-text:          #17201C;
  --color-text-muted:    #68736D;
  --color-border:        #DDE2DE;

  /* ---- Colour: semantic roles (change these to re-map the palette) ------- */
  --color-on-primary:    var(--color-surface);
  --color-link:          var(--color-primary);
  --color-link-hover:    var(--color-primary-dark);
  --color-focus:         var(--color-primary);
  --color-border-strong: var(--color-text-muted);
  --color-disabled-bg:   var(--color-border);
  --color-disabled-text: var(--color-text-muted);
  --color-shadow:        rgb(23 32 28 / 0.08);

  /* Text selection: brown with white text (about 7.4:1 contrast), visible on both the page and white card surfaces. */
  --color-selection-bg:   #7A4A21;
  --color-selection-text: #FFFFFF;

  /* ---- Typography: families --------------------------------------------- */
  /* Noto Nastaliq Urdu is self-hosted (css/base.css). The fallbacks cover the
     moments before it loads and any browser that cannot use it. */
  --font-urdu: "Noto Nastaliq Urdu Variable", "Noto Nastaliq Urdu",
               "Jameel Noori Nastaleeq", "Noto Naskh Arabic", "Segoe UI",
               Tahoma, system-ui, serif;

  /* English (Latin) edition: system fonts only, nothing to download. */
  --font-latin: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
                Arial, "Noto Sans", sans-serif;

  /* Arabic-script system fallback with NO webfont. Used for tiny Urdu strings
     on English pages (the language-switcher label) so an English visitor does
     not download the ~240 KB Nastaliq file for two words. */
  --font-urdu-system: "Noto Naskh Arabic", "Segoe UI", Tahoma, system-ui, serif;

  /* The font the page body uses. Urdu is the default value; the English
     override lives in the language block at the end of this file. */
  --font-body: var(--font-urdu);

  /* ---- Typography: sizes (fluid, rem-based so user zoom is respected) ---- */
  --fs-display: clamp(1.75rem,   1.40rem + 1.60vw, 2.75rem);   /* 28 → 44 */
  --fs-article: clamp(1.625rem,  1.30rem + 1.40vw, 2.50rem);   /* 26 → 40 */
  --fs-page:    clamp(1.5rem,    1.30rem + 1.00vw, 2.25rem);   /* 24 → 36 */
  --fs-section: clamp(1.25rem,   1.15rem + 0.50vw, 1.625rem);  /* 20 → 26 */
  --fs-sub:     1.125rem;                                      /* 18 */
  --fs-lead:    clamp(1.1875rem, 1.10rem + 0.40vw, 1.3125rem); /* 19 → 21 */
  --fs-body:    1.0625rem;                                     /* 17 */
  --fs-nav:     1rem;                                          /* 16 */
  --fs-button:  1rem;                                          /* 16 */
  --fs-meta:    0.9rem;                                        /* ~14.4 */
  --fs-caption: 0.875rem;                                      /* 14 */

  /* ---- Typography: weights ---------------------------------------------- */
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-bold:    700;

  /* ---- Typography: line heights ------------------------------------------
     Nastaliq has tall ascenders and deep descenders; these are deliberately
     more generous than Latin-script values. */
  --lh-display: 1.75;
  --lh-heading: 1.85;
  --lh-body:    2.1;
  --lh-ui:      1.9;

  /* ---- Spacing scale (4px base; rem so it scales with user font size) ---- */
  --space-1:  0.25rem;  /*  4 */
  --space-2:  0.5rem;   /*  8 */
  --space-3:  0.75rem;  /* 12 */
  --space-4:  1rem;     /* 16 */
  --space-6:  1.5rem;   /* 24 */
  --space-8:  2rem;     /* 32 */
  --space-12: 3rem;     /* 48 */
  --space-16: 4rem;     /* 64 */
  --space-20: 5rem;     /* 80 */

  /* ---- Layout ------------------------------------------------------------ */
  --container-max:    75rem;   /* 1200 */
  --container-narrow: 42rem;   /*  672 — reading width */
  --gutter: clamp(1rem, 0.6rem + 2vw, 2rem);
  --tap-target: 2.75rem;       /* 44 — minimum touch target */

  /* ---- Borders, radius, shadow ------------------------------------------ */
  --border-width: 1px;
  --border: var(--border-width) solid var(--color-border);
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px var(--color-shadow);

  /* ---- Focus ------------------------------------------------------------- */
  --focus-ring-width:  3px;
  --focus-ring-offset: 2px;

  /* ---- Motion ------------------------------------------------------------ */
  --transition-fast: 120ms ease;

  /* ---- Link underline clearance (Nastaliq descenders need more) ---------- */
  --underline-offset: 0.4em;
}

/* ==========================================================================
   Language-specific token values
   One design system, two editions. The values above are tuned for Urdu
   (Nastaliq). English pages (<html lang="en">) re-map only the tokens that are
   script-dependent: font family, line heights and underline clearance.
   Colours, spacing, sizes and layout are shared and unchanged.
   Do not add per-language component rules elsewhere; extend this block.
   ========================================================================== */
:root:lang(en) {
  --font-body: var(--font-latin);

  --lh-display: 1.2;
  --lh-heading: 1.3;
  --lh-body:    1.65;
  --lh-ui:      1.5;

  --underline-offset: 0.2em;
}
