/* =====================================================================
   FONTS & TYPOGRAPHY — the ONLY place that controls fonts on the site.
   Loaded last, so it overrides the font settings in the other stylesheets.
   Edit the three FONT ROLES (section 2) to swap a family, or section 3 to change where each role is used.
   Font files live in public/fonts/ (see fonts/README.txt). The files must not be modified (licence).
   ===================================================================== */


/* ---------------------------------------------------------------------
   1. @FONT-FACE  — one block per file. Paths are relative to this css/ folder.
      font-display:swap shows text immediately in the fallback font, then swaps.
   --------------------------------------------------------------------- */


/* MSU Rafida — the site font (v37). One family, two files:
   weights up to 500 use Rafida Medium Tatweel2 (all normal text); weights 600 and above use Rafida Heavy Tatweel2 (titles and everything bold).
   size-adjust makes the Rafida letters 12% larger than the nominal size, because the font is small for its size (its alef is 0.64 of the em).
   Both files get the same number, so bold words inside a paragraph stay the same height as the words around them.
   To change the text size of the whole site, change the two numbers together (100% = the font's own size). Fallback fonts are not affected. */
@font-face{font-family:"Rafida";font-weight:100 500;font-style:normal;font-display:swap;size-adjust:112%;src:url("../fonts/MSURafidaMedium-Tatweel2.woff2") format("woff2")}
@font-face{font-family:"Rafida";font-weight:600 900;font-style:normal;font-display:swap;size-adjust:112%;src:url("../fonts/MSURafidaHeavy-Tatweel2.woff2") format("woff2")}

/* Thmanyah (kept only as a fallback for glyphs Rafida lacks) — Thmanyah Sans: interface and short text (Regular is the "normal" weight) */
@font-face{font-family:"Thmanyah Sans";font-weight:400;font-style:normal;font-display:swap;src:url("../fonts/thmanyahsans-Regular.woff2") format("woff2")}
@font-face{font-family:"Thmanyah Sans";font-weight:500;font-style:normal;font-display:swap;src:url("../fonts/thmanyahsans-Medium.woff2") format("woff2")}
@font-face{font-family:"Thmanyah Sans";font-weight:700;font-style:normal;font-display:swap;src:url("../fonts/thmanyahsans-Bold.woff2") format("woff2")}
@font-face{font-family:"Thmanyah Sans";font-weight:900;font-style:normal;font-display:swap;src:url("../fonts/thmanyahsans-Black.woff2") format("woff2")}

/* Thmanyah Serif Display — big headlines, bismillah, quotes */
@font-face{font-family:"Thmanyah Serif Display";font-weight:700;font-style:normal;font-display:swap;src:url("../fonts/thmanyahserifdisplay-Bold.woff2") format("woff2")}
@font-face{font-family:"Thmanyah Serif Display";font-weight:900;font-style:normal;font-display:swap;src:url("../fonts/thmanyahserifdisplay-Black.woff2") format("woff2")}

/* Thmanyah Serif Text — long reading text */
@font-face{font-family:"Thmanyah Serif Text";font-weight:400;font-style:normal;font-display:swap;src:url("../fonts/thmanyahseriftext-Regular.woff2") format("woff2")}
@font-face{font-family:"Thmanyah Serif Text";font-weight:500;font-style:normal;font-display:swap;src:url("../fonts/thmanyahseriftext-Medium.woff2") format("woff2")}
@font-face{font-family:"Thmanyah Serif Text";font-weight:700;font-style:normal;font-display:swap;src:url("../fonts/thmanyahseriftext-Bold.woff2") format("woff2")}



/* ---------------------------------------------------------------------
   2. FONT ROLES — change a family here and it changes everywhere that role is used.
      Fallbacks matter: characters missing from Thmanyah (Quranic waqf marks, ﷺ ﷽, some Persian letters)
      and the first paint before the files load use the next font in the list.
   --------------------------------------------------------------------- */
:root{
  --f-ui:      "Rafida", "Thmanyah Sans", "Segoe UI", Tahoma, "Geeza Pro", "Noto Sans Arabic", system-ui, sans-serif;
  --f-display: "Rafida", "Thmanyah Serif Display", "Noto Naskh Arabic", "Traditional Arabic", "Geeza Pro", "Times New Roman", serif;
  --f-read:    "Rafida", "Thmanyah Serif Text", "Noto Naskh Arabic", "Traditional Arabic", "Geeza Pro", "Times New Roman", serif;

  /* the older names used all over style.css / pages.css now point to the roles above */
  --font:  var(--f-ui);
  --naskh: var(--f-display);

  /* weights, so a weight is changed in one place */
  /* Body text, menus, dates, summaries, cards, buttons and chips are Regular (400); headings and card titles stay bold. */
  --w-regular: 400;   /* body text and interface (Regular) */
  --w-medium:  700;   /* list-row titles      (Heavy file) */
  --w-bold:    900;   /* titles               (Heavy file) */
  --w-strong:  700;   /* bold words inside long texts (Heavy file) */

  /* line spacing (v37): 1.1 for both Rafida files. Change a number here to change it everywhere. */
  --lh-title: 1.6;    /* headings and titles */
  --lh-body:  2.0;    /* body text, menus, cards */
  --lh-read:  2.0;    /* long reading texts (news, articles, answers, books, descriptions) */
  --lh-ui:    1.5;    /* buttons, fields, tabs, chips: keep their old height */
}


/* ---------------------------------------------------------------------
   3. WHERE EACH ROLE IS USED
   --------------------------------------------------------------------- */

/* 3.1 Base: interface font, regular weight; Arabic needs no letter-spacing */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{font-family:var(--f-ui);font-weight:var(--w-regular);letter-spacing:0;font-kerning:none;font-synthesis:none;
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}
button,input,select,textarea{font-family:inherit}
time,small{font-weight:var(--w-regular)}

/* 3.2 Interface text: navigation, buttons, tabs, filter chips, labels, tags — Regular like the body text */
.menu a,.menu ul,#drawer a,.pill,.btn,.tabs button,.chips a,.tb .btn,.pager a,.share a,.share button,
.tag,.cat,.lb,.k,label,.more,.crumbs,.skip,.qb,.rb,.flash,.badge{font-weight:var(--w-regular)}
.sug a,.srcs a{font-weight:var(--w-regular)}

/* 3.3 Black sans: card and list titles, small headings, numbers */
body .nc h3,body .card h3,body .row h3,body .book h3,body .sr h3,body .ref h4,body .vc h4,body .ep h4,body .li h4,
body .latest h3,body .side h3,body .box h3,body .rowh h3,body .tile h3,body .ask h3,body .ai h3,body .air h3,
body .sh h2,body .po .ttl,body .sc .tx,body .frame .tx,body .tel,body .cd b,body .stats b,body .bio h2{font-family:var(--f-ui);font-weight:var(--w-bold)}
/* list rows are one step lighter than card titles */
body .row h3,body .li h4,body .vc h4,body .ep h4{font-weight:var(--w-medium)}

/* 3.4 Display serif, black: page titles and big headlines */
body .ph h1,body .post h1,body .qa.q h1,body .vt h1,body .ap h1,body .bk h1,body .hero2 h1,
body .lead h3,body .leadx h3,body .cine h3,body .live h2,body .ask h2,body .empty h1,body .prose h2{font-family:var(--f-display);font-weight:var(--w-bold)}

/* 3.5 Display serif, bold: bismillah, quotes, the lead of an article */
body .bs-t,body .bism,body .prose blockquote{font-family:var(--f-display);font-weight:var(--w-medium)}   /* 700 = Serif Display Bold */
body .prose blockquote{line-height:var(--lh-read)}
body .lede,body .prose p:first-child{font-family:var(--f-read);font-weight:var(--w-regular)}

/* 3.6 Reading serif: the long texts of news, articles, answers, books and descriptions */
body .prose,body .prose-s,body .qa.a p,body .at,body .air .at,body .post .prose p{font-family:var(--f-read);font-weight:var(--w-regular)}
body .prose,body .prose-s{line-height:var(--lh-read)}
body .prose strong,body .prose b,body .prose-s strong,body .prose-s b{font-weight:var(--w-strong)}
body .prose em,body .prose i,body .prose-s em,body .prose-s i{font-style:normal}   /* Arabic has no true italics */

/* 3.7 Small text that should stay in the interface font */
body .cap,body .pmeta,body .meta,body .cnt,body .ex,body .disc,body .note{font-family:var(--f-ui)}


/* 3.8 Alignment of long texts: justified (both edges straight) like a printed page.
   Arabic has no hyphenation, so only the spaces between words stretch; the last line of a paragraph stays at the start.
   Headings, captions, tables and code inside the text are not justified. */
body .prose,body .prose-s,body .qa.a p,body .qa.q .prose-s,body .at,body .air .at,body .lede{text-align:justify;text-justify:inter-word;text-align-last:start;hyphens:manual;word-spacing:0}
body .prose :is(h1,h2,h3,h4,h5,h6,figcaption,caption,th,td,pre,code,blockquote){text-align:start;text-align-last:start}
body .prose p,body .prose-s p,body .prose li,body .prose-s li{text-align:justify;text-justify:inter-word}
/* same size for every paragraph (the first one used to be larger), and full-width lines so both edges line up with the white box */
body .prose p:first-child{font-size:inherit}
body .prose p{max-width:none}


/* ---------------------------------------------------------------------
   4. v37 — LINE SPACING AND BISMILLAH
   --------------------------------------------------------------------- */

/* 4.1 line spacing 1.1 for text (the numbers are the variables in section 2) */
html body{line-height:var(--lh-body)}
body :is(h1,h2,h3,h4,h5,h6){line-height:var(--lh-title)}
body .ph h1,body .post h1,body .qa.q h1,body .vt h1,body .ap h1,body .bk h1,body .hero2 h1,body .lead h3,body .leadx h3,body .cine h3,body .live h2,body .ask h2,body .nc h3,body .card h3,body .row h3,body .sr h3,body .hero h1,body .hero h2,body .hero h3{line-height:var(--lh-title)}
body .prose,body .prose-s,body .prose p,body .prose-s p,body .prose li,body .prose-s li,body .qa.a p,body .at,body .air .at,body .lede,body .prose blockquote{line-height:var(--lh-read)}

/* 4.2 controls keep their old height: tabs, menus, buttons, chips, fields */
body :is(.menu a,.menu ul,#drawer a,.pill,.btn,.tabs button,.chips a,.chip,.tb .btn,.pager a,.share a,.share button,.tag,.cat,.badge,.more,.sug a,.srcs a,.qb,.rb,.lb),
body :is(button,input,select,textarea,.sbar input,.sbar button){line-height:var(--lh-ui)}

/* 4.3 bismillah: real text in Rafida Medium (the font size here is divided by the 1.12 size-adjust so the bismillah keeps the size you approved); the kashida (tatweel) letters are written in the text itself (see layout.php).
   The line box is fixed at 1.6rem (the height the old bismillah had), so the black bar keeps its old height. */
body .bs-t{font-family:var(--f-ui);font-weight:400;font-size:.9rem;height:1.6rem;line-height:1.6rem;display:flex;align-items:center;justify-content:center;margin:0;letter-spacing:0;white-space:nowrap}
@media(min-width:900px){body .bs-t{font-size:.95rem}}
/* v40 — the bismillah has the same size as the date next to it (.9rem on a phone, .95rem from 900px); the bar keeps its height (the fixed 1.6rem line box above) */

/* v41 — font-kerning:none on body (line 75): with kerning on, the selection highlight and the glyphs of the Rafida font were laid out differently (the highlight landed in the wrong place and letters seemed to disappear). Body text is justified again, as before. */
