/* ============================================================
   MMSx Exercise Comparison — Multilingual Print Stylesheet
   Drop-in additive sheet. Include AFTER the existing print.css.

   Fixes:
     1. Devanagari (Hindi) conjuncts (निचला, डेडलिफ़्ट)
     2. Arabic Naskh ligatures
     3. Latin diacritics for Spanish (ñ, á, é)

   Deployment:
     Upload as: /edu/exercise-comprasion/print-multilang.css
     Include in HTML <head>:
       <link rel="stylesheet" href="print-multilang.css" media="print">
   ============================================================ */

/* Pull web fonts. Google Fonts CDN. Subset to weights actually used. */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;700&family=Noto+Naskh+Arabic:wght@400;700&display=swap');

/* For SCREEN: keep the existing institute typography (EB Garamond, Source Sans 3). */
/* For PRINT: switch language-specific containers to multilingual-capable fonts. */

@media print {
  /* English / Spanish — keep institute serif */
  html[lang="en"] body,
  html[lang="es"] body,
  body[lang="en"],
  body[lang="es"],
  [lang="en"],
  [lang="es"] {
    font-family: 'EB Garamond', 'Times New Roman', Georgia, serif !important;
  }

  /* Hindi — Devanagari with proper conjunct rendering */
  html[lang="hi"],
  html[lang="hi"] body,
  body[lang="hi"],
  [lang="hi"],
  .lang-hi,
  *[data-lang="hi"] {
    font-family: 'Noto Sans Devanagari', 'Mangal', 'Lohit Devanagari', 'EB Garamond', serif !important;
    font-feature-settings: "kern", "liga", "calt" !important;
    text-rendering: optimizeLegibility !important;
    -webkit-font-feature-settings: "kern", "liga", "calt" !important;
  }

  /* Arabic — Naskh with bidirectional + ligatures */
  html[lang="ar"],
  html[lang="ar"] body,
  body[lang="ar"],
  [lang="ar"],
  .lang-ar,
  *[data-lang="ar"] {
    font-family: 'Noto Naskh Arabic', 'Amiri', 'Traditional Arabic', serif !important;
    direction: rtl !important;
    text-align: right !important;
    font-feature-settings: "kern", "liga", "calt", "rlig" !important;
    -webkit-font-feature-settings: "kern", "liga", "calt", "rlig" !important;
    unicode-bidi: embed;
  }

  /* Headings inherit but bump weight */
  html[lang="hi"] h1, html[lang="hi"] h2, html[lang="hi"] h3,
  [lang="hi"] h1, [lang="hi"] h2, [lang="hi"] h3 {
    font-family: 'Noto Sans Devanagari', serif !important;
    font-weight: 700 !important;
  }

  html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3,
  [lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3 {
    font-family: 'Noto Naskh Arabic', serif !important;
    font-weight: 700 !important;
  }

  /* Tables and prose blocks inside language-specific containers */
  [lang="hi"] table, [lang="hi"] th, [lang="hi"] td,
  [lang="hi"] p, [lang="hi"] li, [lang="hi"] div, [lang="hi"] span {
    font-family: inherit !important;
  }

  [lang="ar"] table, [lang="ar"] th, [lang="ar"] td,
  [lang="ar"] p, [lang="ar"] li, [lang="ar"] div, [lang="ar"] span {
    font-family: inherit !important;
    direction: rtl !important;
  }

  /* Code/monospace — keep JetBrains Mono if used, fallback otherwise */
  [lang="hi"] code, [lang="hi"] pre,
  [lang="ar"] code, [lang="ar"] pre {
    font-family: 'JetBrains Mono', 'Courier New', monospace !important;
  }

  /* Ensure the muscle-graph image isn't squeezed off the page */
  .muscle-graph-print,
  img[data-role="muscle-graph"],
  canvas[id*="muscle"] {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid !important;
    display: block !important;
    margin: 1em auto !important;
  }

  /* MMSx Institute design system colours preserved in print */
  .mmsx-navy   { color: #0f2341 !important; }
  .mmsx-gold   { color: #c9a84c !important; }
  .mmsx-cream  { background: #f8f6f0 !important; }

  /* A4 paper geometry — institute standard */
  @page {
    size: A4 portrait;
    margin: 18mm 16mm 18mm 16mm;
  }
}

/* SCREEN-FACING fallback so the page reads correctly online too */
@media screen {
  [lang="hi"] {
    font-family: 'Noto Sans Devanagari', 'EB Garamond', 'Mangal', serif;
  }
  [lang="ar"] {
    font-family: 'Noto Naskh Arabic', 'EB Garamond', 'Amiri', serif;
    direction: rtl;
  }
}
