/* TeX Gyre Pagella 2.501, unmodified GUST OpenType faces. The portal uses the
   four original OpenType files from the complete distribution at
   https://ctan.org/pkg/tex-gyre-pagella. Package notices are alongside them. */
@font-face {
  font-family: "TeX Gyre Pagella";
  src: url("texgyrepagella-regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "TeX Gyre Pagella";
  src: url("texgyrepagella-italic.otf") format("opentype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "TeX Gyre Pagella";
  src: url("texgyrepagella-bold.otf") format("opentype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "TeX Gyre Pagella";
  src: url("texgyrepagella-bolditalic.otf") format("opentype");
  font-style: italic;
  font-weight: 700;
  font-display: swap;
}

html:root body:is(.wn-quiet-editorial.wn-portal-design,.wn-demo-entry,.wn-studio-wiki,.wn-quiet-onboarding,.wn-access-notice) {
  --wn-pagella-face: "TeX Gyre Pagella", "Times New Roman", Times, serif;
  --font-family-system-sans: var(--wn-pagella-face) !important;
  --font-family-serif: var(--wn-pagella-face) !important;
  --tks-font-ui: var(--wn-pagella-face) !important;
  --space-face: var(--wn-pagella-face) !important;
  --nv-face: var(--wn-pagella-face) !important;
  --se-ui: var(--wn-pagella-face) !important;
  font-family: var(--wn-pagella-face) !important;
}

/* Technical syntax surfaces and font-based icons retain their own family.
   Editable article and comment text uses the Studio face. */
html:root body:is(.wn-quiet-editorial.wn-portal-design,.wn-demo-entry,.wn-studio-wiki,.wn-quiet-onboarding,.wn-access-notice)
  :is(a,button,input,select,textarea,summary,label,p,small,li,table,thead,td,th,h1,h2,h3,h4,h5,h6,span,div,nav,section,aside,caption,legend,dt,dd,blockquote,strong,em,b,i,[contenteditable="true"]):not(:where(
    pre *,code *,kbd *,samp *,svg *,[class^="CodeMirror"],[class^="CodeMirror"] *,
    .cm-editor,.cm-editor *,.mw-editfont-monospace,.oo-ui-iconElement-icon,.cdx-icon,
    .mw-ui-icon,.vector-icon,.wn-tool-icon,.wn-work-icon,.dashicons,[aria-hidden="true"][class*="icon"]
  )) {
  font-family: var(--wn-pagella-face) !important;
}

html:root body.wn-studio-wiki :is(#mw-content-text,#cartograph,#cg-workbench,#librarian-root)
  :is(.ve-ce-documentNode,.wnie-editor,.cg-textarea,.cs-scratch-editor,.librarian-standalone-reader,[contenteditable="true"]):not(:where(.cm-content,.cm-editor *)) {
  font-family: var(--wn-pagella-face) !important;
}

/* Match the existing named portal layer, which owns final form and account typography. */
@layer studio-portal-controls {
  body:is(.wn-portal-design,.wn-demo-entry),
  body:is(.wn-portal-design,.wn-demo-entry) :where(*):not(svg,svg *):not(:where(
    pre,pre *,code,code *,kbd,kbd *,samp,samp *,[class^="CodeMirror"],[class^="CodeMirror"] *,
    .cm-editor,.cm-editor *,.mw-editfont-monospace,.oo-ui-iconElement-icon,.cdx-icon,.vector-icon,
    .mw-ui-icon,.wn-tool-icon,.wn-work-icon,.dashicons,[aria-hidden="true"][class*="icon"]
  )) {
    font-family: var(--wn-pagella-face) !important;
  }
}
