/* Self-hosted Montserrat, SIL OFL 1.1. Variable weight range: 400–700. */
/* cyrillic-ext */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url('../fonts/montserrat/montserrat-cyrillic-ext-400-700.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url('../fonts/montserrat/montserrat-cyrillic-400-700.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* vietnamese */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url('../fonts/montserrat/montserrat-vietnamese-400-700.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url('../fonts/montserrat/montserrat-latin-ext-400-700.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url('../fonts/montserrat/montserrat-latin-400-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Width-adjusted Arial fallback; metrics taken from the bundled font.
   Latin and Cyrillic are preloaded; block prevents a cold-load fallback from sticking. */
@font-face {
  font-family: 'Montserrat Fallback';
  src: local('Arial');
  font-weight: 400 500;
  size-adjust: 111.75%;
  ascent-override: 86.62%;
  descent-override: 22.46%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Montserrat Fallback';
  src: local('Arial Bold');
  font-weight: 600 700;
  size-adjust: 111.75%;
  ascent-override: 86.62%;
  descent-override: 22.46%;
  line-gap-override: 0%;
}

:root {
  --font: 'Montserrat', 'Montserrat Fallback', Arial, sans-serif;
  --text-meta: .75rem;       /* 12px: compact metadata */
  --text-label: .8125rem;   /* 13px: controls and navigation */
  --text-body: .875rem;     /* 14px: body and tables */
  --text-card: 1rem;        /* 16px: card headings and reading */
  --text-lg: 1.125rem;
  --text-section: 1.25rem;  /* 20px: section headings */
  --text-xl: 1.5rem;
  --text-page: 1.75rem;     /* 28px: page headings */
  --text-metric: 2rem;
  --text-display: 2.5rem;
  --text-hero: 3rem;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --leading-heading: 1.25;
  --leading-control: 1.5;
  --leading-body: 1.6;
  --leading-reading: 1.75;
  --tracking-heading: -.025em;
  --tracking-body: 0;
  --tracking-label: .035em;
}

body, .app-body {
  font-family: var(--font);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  font-synthesis: style;
}
button, input, select, textarea, optgroup, .ts-control, .ts-dropdown {
  font-family: var(--font);
  letter-spacing: var(--tracking-body);
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading);
}
:root :is(h1, .page-title, .reader-title) { font-size: var(--text-page); font-weight: var(--weight-bold); line-height: var(--leading-heading); }
:root :is(h2, .section-title) { font-size: var(--text-section); }
:root :is(h3, .card__title, .form-section__title) { font-size: var(--text-card); font-weight: var(--weight-semibold); line-height: 1.4; }
h4, h5, h6 { font-size: var(--text-body); }
strong, b { font-weight: var(--weight-semibold); }
.page-subtitle, .form-section__sub { font-size: var(--text-body); line-height: var(--leading-body); }
.page-subtitle { max-width: 80ch; }
.card__title, .page-header__left { min-width: 0; }

/* Shared controls, navigation, and dense enterprise data. */
.btn, .btn--sm, .btn-primary, .btn-signin, .reader-topbar__close {
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-control);
  letter-spacing: var(--tracking-body);
}
.btn--lg { font-size: var(--text-body); }
.form-input, .form-select, .form-textarea, .ts-control, .ts-dropdown {
  font-size: var(--text-body);
  line-height: var(--leading-control);
}
.form-label { font-size: var(--text-label); font-weight: var(--weight-medium); line-height: var(--leading-control); }
.form-hint, .text-xs, .badge, .role-badge, .audit-item__meta { font-size: var(--text-meta); line-height: var(--leading-control); }
.text-sm { font-size: var(--text-body); }
.text-muted, .form-hint, .page-subtitle, .form-section__sub { color: var(--stone-600, #6B635A); }
.data-table { font-size: var(--text-body); line-height: var(--leading-control); }
.data-table th { font-size: var(--text-meta); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-label); }
.data-table :is(th, td), .stat-card__value { font-variant-numeric: tabular-nums; }
.stat-card__value { font-size: var(--text-metric); font-weight: var(--weight-bold); line-height: var(--leading-heading); letter-spacing: var(--tracking-heading); }
.stat-card__label { font-size: var(--text-meta); letter-spacing: var(--tracking-label); line-height: var(--leading-control); }
.shell-nav__item { font-size: var(--text-label); line-height: var(--leading-control); }
.shell-nav__label { font-size: var(--text-meta); color: var(--stone-400); letter-spacing: var(--tracking-label); }
.shell-user__name { font-size: var(--text-label); }
.shell-user__role { font-size: var(--text-meta); color: var(--stone-400); }
.shell-topbar__breadcrumbs { font-size: var(--text-label); }

/* Longer instructions and process documentation get a comfortable reading rhythm. */
:root :is(.article-body, .reader-body, .lesson-text, .ql-editor) {
  font-family: var(--font);
  font-size: var(--text-card);
  line-height: var(--leading-reading);
  overflow-wrap: break-word;
}
:root :is(.article-body, .reader-body, .lesson-text, .ql-editor) :is(h1, h2) {
  font-size: var(--text-section);
  line-height: 1.35;
  margin-block: 1.5em .6em;
}
:root :is(.article-body, .reader-body, .lesson-text, .ql-editor) h3 { font-size: var(--text-lg); margin-block: 1.25em .5em; }
#org-chart [style*="font-size"], #popup-name, #popup-desc { overflow-wrap: break-word; }
#popup-name { line-height: 1.4; }
.auth-title, .form-header h1 { font-size: var(--text-xl); line-height: var(--leading-heading); }
.auth-sub, .auth-back, .success-sub, .form-footer-note { color: #6B635A; }
.login-side .side-quote__sub, .login-side .side-badge { color: rgba(255,255,255,.72); }

/* Long employee names retain their full text within the existing sidebar. */
.shell-user__name { white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }

/* Also covers standalone readers, which intentionally omit the app shell. */
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible { outline:2px solid #8b602e;outline-offset:3px; }
:where(.shell-sidebar,.process-stage-nav,.process-scheme) :focus-visible { outline-color:#e1bd8c; }
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto!important;animation:none!important;transition:none!important; }
}
