/* Urdu typography for every POST and STATUS surface
   (feed posts, comments, reposts/shares, status viewer, reels, status cards,
   status caption composer, admin moderation previews).

   ONE font only:  Nafees Web Naskh
   -------------------------------------------------------------------------
   The font file is supplied by the site owner and served from the project's
   own folder — no CDN, no Google, no third-party font URL, no local() lookup
   of an installed system font:

       public/fonts/urdu/Nafees_Regular.ttf

   It is only downloaded when a page actually contains Arabic-script text
   (unicode-range), so English-only pages never pay for it. English / Latin
   letters and digits inside an Urdu post keep the site's normal UI font.

   Only a Regular weight exists, so <b>/<strong> and titles use the browser's
   synthetic bold (font-weight is therefore declared as 400, NOT a 400-700
   range, otherwise the browser would think a real bold face exists and would
   not embolden anything).

   Must be loaded AFTER fp-universal-text.css (it is, in layouts/app.blade.php;
   layouts/admin.blade.php loads it too). */

@font-face {
  font-family: 'Nafees Web Naskh';
  src: url('../fonts/urdu/Nafees_Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F,U+2010-2011,U+25CC;
}

:root {
  /* The single Urdu font stack used everywhere. Anything Nafees does not cover
     (Latin letters, ASCII digits, emoji) falls through to the device UI font. */
  --fp-urdu-font: 'Nafees Web Naskh', system-ui, sans-serif;
  /* Naskh needs less vertical room than Nastaliq (font content-area is 1.36em). */
  --fp-urdu-lh: 1.8;
}

/* Status captions / titles when their text is RTL (dir="auto" resolves from the
   first strong letter, so English captions are untouched). */
.fpr-caption:dir(rtl),
.fpr-title:dir(rtl),
.friende-viewer-caption-text:dir(rtl),
.friende-status-richtext:dir(rtl),
.fps-status-copy:dir(rtl),
.fps-status-title:dir(rtl),
.fps-rich-editor:dir(rtl) {
  font-family: var(--fp-urdu-font) !important;
  direction: rtl !important;
  text-align: right !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
  unicode-bidi: plaintext !important;
}

/* Old browsers without :dir() - fp-universal-text.js sets data-fp-rtl="1" there. */
.fpr-caption[data-fp-rtl="1"],
.fpr-title[data-fp-rtl="1"],
.friende-viewer-caption-text[data-fp-rtl="1"],
.friende-status-richtext[data-fp-rtl="1"] {
  font-family: var(--fp-urdu-font) !important;
  direction: rtl !important;
  text-align: right !important;
  font-weight: 400 !important;
}

/* Titles can remain slightly stronger without making normal Urdu captions bold. */
.fpr-title:dir(rtl),
.friende-viewer-caption-text[style*="font-weight:700"]:dir(rtl),
.fps-status-title:dir(rtl) { font-weight: 700 !important; }

/* Bold the user asked for (<b>/<strong>) inside an Urdu caption. */
.friende-status-richtext:dir(rtl) b,
.friende-status-richtext:dir(rtl) strong { font-weight: 700 !important; }

/* Mixed-script captions: resolve direction from the first strong character. */
.fpr-caption,
.fpr-title,
.friende-viewer-caption-text,
.friende-status-richtext,
.fps-status-copy,
.fps-status-title {
  unicode-bidi: plaintext;
  overflow-wrap: anywhere;
  word-break: normal;
  text-align: start;
}

/* One-line caption on the feed's status/reel card (status-reel-card.blade.php). */
.fp-reel-caption-line:dir(rtl) { font-family: var(--fp-urdu-font); }
.fp-reel-caption-line[data-fp-rtl="1"] { font-family: var(--fp-urdu-font); }

/* Text the creator drags onto a status photo (preview in the composer; the
   saved JPEG is drawn on a canvas with the same font — composer-scripts). */
.friende-editor-text { font-family: 'Nafees Web Naskh', Figtree, Arial, sans-serif; }
.friende-editor-text:dir(rtl) { line-height: 1.6; }

/* Admin panel (layouts/admin.blade.php): moderators review the same posts and
   statuses, so Urdu text there uses Nafees Web Naskh too. Arabic-script letters
   only (unicode-range) - English text keeps the admin's normal font stack. */
html.friende-admin body {
  font-family: 'Nafees Web Naskh', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
