/* ============================================================================
   QUANTUMAI — TYPOGRAPHY LAYER (theme font selector)

   Ported from the MPK theme together with styles/palettes.css. It is the
   font half of the same contract: the colour gallery is keyed on
   [data-qai-palette], this layer is keyed on [data-qai-font].

   NOTHING HERE APPLIES UNTIL A FONT IS CHOSEN. QuantumAIThemePlugin only
   writes data-qai-font on <html> when Website Settings > Appearance > Theme
   has a font other than "QuantumAI default" selected. With the default
   selection the attribute is absent, every rule below fails to match, and
   the theme keeps its original Inter / Georgia typography untouched.

   The three custom properties this layer reads are supplied inline by the
   plugin, after every stylesheet, so the chosen face, slant and weight win
   without !important on the variables themselves:

     --qai-font           body / UI / forms / navigation
     --qai-heading        headings (the plugin sets it to the same family)
     --qai-heading-style  italic | normal
     --qai-heading-weight 500 | 600 | 700 | 800

   The fallbacks in var() repeat the plugin's defaults so a browser serving
   a stale styles/variables.css still renders the chosen font correctly.
   ============================================================================ */

[data-qai-font] body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* One coherent editorial family throughout the public journal UI. */
[data-qai-font] .qai-home,
[data-qai-font] .pkp_structure_page,
[data-qai-font] .pkp_structure_content,
[data-qai-font] .pkp_structure_main,
[data-qai-font] .pkp_structure_sidebar,
[data-qai-font] .pkp_site_name,
[data-qai-font] .pkp_navigation_primary,
[data-qai-font] .pkp_navigation_user,
[data-qai-font] .page_index_journal {
  font-family: var(--qai-heading);
  font-weight: 500;
}

/* Display and section headings: the chosen slant and weight.
   !important is needed because the theme's own selectors match these
   elements with the same specificity. */
[data-qai-font] .qai-hero__title,
[data-qai-font] .qai-card__title,
[data-qai-font] .qai-section-head h2,
[data-qai-font] .qai-step h3,
[data-qai-font] .qai-feature h3,
[data-qai-font] .qai-hub-card strong,
[data-qai-font] .pkp_site_name .is_text,
[data-qai-font] .page > h1,
[data-qai-font] .page_title,
[data-qai-font] .obj_article_details > .page_title,
[data-qai-font] .page_index_journal .current_issue > h2,
[data-qai-font] .page_index_journal .cmp_announcements > h2,
[data-qai-font] .obj_issue_toc .section > h2,
[data-qai-font] .obj_issue_toc .section > h3,
[data-qai-font] .obj_article_summary .title a,
[data-qai-font] .obj_issue_summary .title,
[data-qai-font] .pkp_page_title,
[data-qai-font] .page h1,
[data-qai-font] .page h2,
[data-qai-font] .page h3 {
  font-family: var(--qai-heading) !important;
  font-style: var(--qai-heading-style, italic);
  font-weight: var(--qai-heading-weight, 600);
  letter-spacing: -0.015em;
}

/* Secondary headings stay upright and readable in the same family. */
[data-qai-font] .obj_article_details .item.abstract > .label,
[data-qai-font] .obj_article_details .item.references > .label {
  font-family: var(--qai-heading) !important;
  font-style: normal;
  letter-spacing: normal;
}

/* Navigation and controls stay readable while retaining the same family. */
[data-qai-font] .pkp_navigation_primary > li > a,
[data-qai-font] .pkp_navigation_user > li > a,
[data-qai-font] .qai-btn,
[data-qai-font] .qai-stat__label,
[data-qai-font] .qai-index-link,
[data-qai-font] .read_more {
  font-family: var(--qai-heading);
  font-weight: 600;
}

/* Statistics use the same display treatment as the headings. */
[data-qai-font] .qai-stat__value {
  font-family: var(--qai-heading) !important;
  font-style: var(--qai-heading-style, italic);
  font-weight: var(--qai-heading-weight, 600) !important;
}
