/* =============================================================
   Darila — Font Patch (Kantumruy Pro for Khmer, Cal Sans for English)
   Load this file LAST after your other CSS files.
   Uses Google Fonts via @import for convenience.
   ============================================================= */

/* Load fonts (you can also use <link> in HTML; see README) */
@import url('https://fonts.googleapis.com/css2?family=Kantumruy+Pro:wght@300;400;500;700&family=Cal+Sans:wght@400;600;700&display=swap');

:root{
  --font-latin: "Cal Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-khmer: "Kantumruy Pro", "Cal Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Default = English/Latin UI with Cal Sans */
html{
  font-family: var(--font-latin);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* When the page is Khmer (your i18n toggles <html lang="kh">) */
html[lang="kh"]{
  font-family: var(--font-khmer);
  line-height: 1.45; /* more comfortable for Khmer script */
}

/* If you have mixed-language blocks, you can force Khmer font like this: */
:lang(km), .kh{
  font-family: var(--font-khmer);
}

/* Optional: headings keep Cal Sans even in Khmer UI if they contain Latin */
h1,h2,h3,h4,h5,h6{
  font-family: "Cal Sans", var(--font-khmer), system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
}

/* Buttons/inputs inherit the same stacks */
button,input,select,textarea{
  font-family: inherit;
}
