/*
 * Dr. Shahriyari — Persian/Farsi global typography v2.6.27
 * Scope: every frontend surface whose document language is Persian (fa).
 * Display/title font: Lalezar. Body/UI font: Shabnam.
 * Font binaries are intentionally not bundled; fonts are loaded by the theme
 * from their pinned public providers only on Persian pages.
 */

html[lang^="fa"],
body.dsh-lang-fa{
  --dsh-fa-display:"Lalezar","Noto Naskh Arabic","Noto Sans Arabic",Tahoma,serif;
  --dsh-fa-body:"Shabnam","Noto Sans Arabic",Tahoma,Arial,sans-serif;
  --dsh-fa-h1:clamp(2.15rem,4.6vw,4rem);
  --dsh-fa-h2:clamp(1.7rem,3.1vw,2.85rem);
  --dsh-fa-h3:clamp(1.18rem,1.75vw,1.62rem);
  --dsh-fa-h4:clamp(1.04rem,1.3vw,1.3rem);
  font-family:var(--dsh-fa-body);
  font-kerning:normal;
  text-rendering:optimizeLegibility;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/*
 * Body/UI layer. This intentionally loads after all page-specific CSS so old
 * Persian Noto/serif declarations cannot create inconsistent typography.
 */
html[lang^="fa"] body,
body.dsh-lang-fa,
html[lang^="fa"] body :where(div,section,article,aside,main,header,footer,nav,p,ul,ol,li,dl,dt,dd,blockquote,figcaption,details,summary,label,a,button,input,textarea,select,option,table,thead,tbody,tfoot,tr,th,td,span,small,strong,b,em,i,time,address),
body.dsh-lang-fa :where(div,section,article,aside,main,header,footer,nav,p,ul,ol,li,dl,dt,dd,blockquote,figcaption,details,summary,label,a,button,input,textarea,select,option,table,thead,tbody,tfoot,tr,th,td,span,small,strong,b,em,i,time,address){
  font-family:var(--dsh-fa-body)!important;
  letter-spacing:0!important;
}

html[lang^="fa"] body{
  font-size:1rem;
  line-height:1.85;
}

html[lang^="fa"] :where(p,li,dd,blockquote),
body.dsh-lang-fa :where(p,li,dd,blockquote){
  line-height:1.9!important;
}

html[lang^="fa"] :where(button,input,textarea,select,summary,.wp-element-button,.wp-block-button__link),
body.dsh-lang-fa :where(button,input,textarea,select,summary,.wp-element-button,.wp-block-button__link){
  font-size:clamp(.92rem,.9rem + .08vw,1rem);
  line-height:1.65;
}

/*
 * Display/title layer. Semantic headings plus the theme's non-heading title
 * classes always use Lalezar. Descendants inherit Lalezar so linked/card titles
 * do not fall back to the body font.
 */
html[lang^="fa"] :where(
  h1,h2,h3,h4,h5,h6,
  .wp-block-post-title,
  .wp-block-site-title,
  .wp-block-query-title,
  .wp-block-heading,
  .dsh-abt260-mast__brand,
  [class*="__title"],
  [class*="-title"]
),
body.dsh-lang-fa :where(
  h1,h2,h3,h4,h5,h6,
  .wp-block-post-title,
  .wp-block-site-title,
  .wp-block-query-title,
  .wp-block-heading,
  .dsh-abt260-mast__brand,
  [class*="__title"],
  [class*="-title"]
){
  font-family:var(--dsh-fa-display)!important;
  font-weight:400!important;
  font-style:normal;
  font-synthesis:none;
  letter-spacing:0!important;
  word-spacing:normal;
  text-wrap:balance;
}

html[lang^="fa"] :where(h1,h2,h3,h4,h5,h6,.wp-block-post-title,.wp-block-site-title,.wp-block-query-title,[class*="__title"],[class*="-title"]) :where(a,span,strong,b,em,i),
body.dsh-lang-fa :where(h1,h2,h3,h4,h5,h6,.wp-block-post-title,.wp-block-site-title,.wp-block-query-title,[class*="__title"],[class*="-title"]) :where(a,span,strong,b,em,i){
  font-family:inherit!important;
  font-weight:inherit!important;
  letter-spacing:inherit!important;
}

/* Professional Persian type scale — intentionally restrained across pages. */
html[lang^="fa"] :where(h1,.wp-block-post-title),
body.dsh-lang-fa :where(h1,.wp-block-post-title){
  font-size:var(--dsh-fa-h1)!important;
  line-height:1.22!important;
  max-width:22ch;
}

html[lang^="fa"] :where(h2,.wp-block-query-title),
body.dsh-lang-fa :where(h2,.wp-block-query-title){
  font-size:var(--dsh-fa-h2)!important;
  line-height:1.3!important;
}

html[lang^="fa"] h3,
body.dsh-lang-fa h3{
  font-size:var(--dsh-fa-h3)!important;
  line-height:1.4!important;
}

html[lang^="fa"] :where(h4,h5,h6),
body.dsh-lang-fa :where(h4,h5,h6){
  font-size:var(--dsh-fa-h4)!important;
  line-height:1.48!important;
}

html[lang^="fa"] .dsh-abt260-mast__brand,
body.dsh-lang-fa .dsh-abt260-mast__brand{
  font-size:clamp(2rem,5vw,3.5rem)!important;
  line-height:1.22!important;
}

/* Titles rendered as non-heading elements keep their component's existing size. */
html[lang^="fa"] :where([class*="__title"],[class*="-title"]):not(h1):not(h2):not(h3):not(h4):not(h5):not(h6),
body.dsh-lang-fa :where([class*="__title"],[class*="-title"]):not(h1):not(h2):not(h3):not(h4):not(h5):not(h6){
  line-height:1.42!important;
}

/* Keep code/technical literals legible and unaffected by Persian font rules. */
html[lang^="fa"] :where(code,pre,kbd,samp),
body.dsh-lang-fa :where(code,pre,kbd,samp){
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace!important;
  letter-spacing:normal!important;
}

/* Persian navigation and compact UI should remain crisp, not oversized. */
html[lang^="fa"] :where(.dsh-header,.dsh-nav,.dsh-breadcrumb,.dsh-button,.wp-block-navigation,.wp-block-button),
body.dsh-lang-fa :where(.dsh-header,.dsh-nav,.dsh-breadcrumb,.dsh-button,.wp-block-navigation,.wp-block-button){
  font-family:var(--dsh-fa-body)!important;
}

@media (max-width:782px){
  html[lang^="fa"],body.dsh-lang-fa{
    --dsh-fa-h1:clamp(2rem,9vw,2.85rem);
    --dsh-fa-h2:clamp(1.55rem,7vw,2.2rem);
    --dsh-fa-h3:clamp(1.12rem,5vw,1.42rem);
  }
  html[lang^="fa"] body,
  body.dsh-lang-fa{
    font-size:1rem;
  }
}

@media (max-width:420px){
  html[lang^="fa"],body.dsh-lang-fa{
    --dsh-fa-h1:clamp(1.9rem,9.7vw,2.55rem);
    --dsh-fa-h2:clamp(1.48rem,7.2vw,2rem);
  }
}
