/*
 * CCSC brand typefaces for the interface.
 *
 * Ping for Latin, Qomra for Arabic. The split has to be done with
 * unicode-range, not with the order of a font stack: PingAR+LT carries 203
 * Arabic glyphs of its own, so "font-family: ping, qomra" would render Arabic
 * in Ping and Qomra would never be reached. unicode-range makes the browser
 * choose per character instead.
 *
 * Neither family has any CJK, so the stack keeps real fallbacks after them for
 * the Chinese team, whose interface must not lose its glyphs.
 *
 * font-display: swap - text stays readable while the files load rather than
 * flashing invisible.
 */

/* Latin, digits, punctuation and currency. */
@font-face {
    font-family: 'CCSC Ping';
    src: url('ping-300.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2070-209F, U+20A0-20CF, U+2100-214F, U+2190-21FF, U+2200-22FF;
}

@font-face {
    font-family: 'CCSC Ping';
    src: url('ping-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2070-209F, U+20A0-20CF, U+2100-214F, U+2190-21FF, U+2200-22FF;
}

/* One file covers 500 and 600: Perfex uses both and they are close enough
   that a synthesised weight would look worse than sharing Medium. */
@font-face {
    font-family: 'CCSC Ping';
    src: url('ping-500.woff2') format('woff2');
    font-weight: 500 600;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2070-209F, U+20A0-20CF, U+2100-214F, U+2190-21FF, U+2200-22FF;
}

@font-face {
    font-family: 'CCSC Ping';
    src: url('ping-700.woff2') format('woff2');
    font-weight: 700 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2070-209F, U+20A0-20CF, U+2100-214F, U+2190-21FF, U+2200-22FF;
}

/* Arabic block, Arabic Supplement, Extended-A and the presentation forms that
   shaping engines fall back to. */
@font-face {
    font-family: 'CCSC Qomra';
    src: url('qomra-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

@font-face {
    font-family: 'CCSC Qomra';
    src: url('qomra-500.woff2') format('woff2');
    font-weight: 500 600;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

@font-face {
    font-family: 'CCSC Qomra';
    src: url('qomra-700.woff2') format('woff2');
    font-weight: 700 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

/*
 * Applied through a variable so anything in Perfex that reads the theme font
 * picks it up too, then forced on the body and on the elements that browsers
 * do not inherit into (form controls and buttons).
 */
:root {
    --ccsc-font: 'CCSC Ping', 'CCSC Qomra', 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body,
.dropdown-menu,
.modal,
.tooltip,
.popover,
.swal2-container,
.select2-container,
.bootstrap-select .dropdown-menu {
    font-family: var(--ccsc-font);
}

/* Form controls and buttons inherit from the UA, not from body. */
input,
textarea,
select,
button,
.btn,
.form-control,
.dataTables_wrapper,
.note-editor,
.note-editable {
    font-family: var(--ccsc-font);
}

/* Headings and the sidebar carry the brand most visibly. */
h1, h2, h3, h4, h5, h6,
#side-menu,
.navbar,
.panel-heading,
.dataTable thead th {
    font-family: var(--ccsc-font);
}

/*
 * Left untouched on purpose: anything monospaced. Code, keys and log output
 * rely on fixed advance widths, and neither brand face is monospaced.
 */
code, pre, kbd, samp, .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
