/*
 * Inter Fonts for Nextcloud — generated stylesheet
 *
 * No external requests: WOFF2 binaries are bundled and served by this app.
 * No CLS:   metric-compatible synthetic Arial fallback matches Inter's
 *           vertical metrics until the real font has swapped in.
 * No FOUT:  BeforeTemplateRenderedListener injects <link rel="preload">
 *           for both WOFF2 files so download starts with the HTML parse.
 * No var():  font-family uses a literal stack — theming cannot override it
 *           by redefining --font-face after this sheet loads.
 */

@font-face {
    font-family: 'InterVariable';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/wolke/index.php/apps/interfonts/font/InterVariable-4.1.woff2') format('woff2-variations'),
         url('/wolke/index.php/apps/interfonts/font/InterVariable-4.1.woff2') format('woff2');
}

@font-face {
    font-family: 'InterVariable';
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url('/wolke/index.php/apps/interfonts/font/InterVariable-Italic-4.1.woff2') format('woff2-variations'),
         url('/wolke/index.php/apps/interfonts/font/InterVariable-Italic-4.1.woff2') format('woff2');
}

/* Metric-compatible fallback — calibrated against Vercel @next/font for Inter v4.
 * https://github.com/vercel/next.js/tree/canary/packages/font
 * Matches Inter's ascent/descent/size so the swap causes zero CLS. */

@font-face {
    font-family: 'InterVariable Fallback';
    font-style: normal;
    src: local('Arial');
    ascent-override: 90.20%;
    descent-override: 22.48%;
    line-gap-override: 0.00%;
    size-adjust: 107.40%;
}

@font-face {
    font-family: 'InterVariable Fallback';
    font-style: italic;
    src: local('Arial Italic'), local('Arial');
    ascent-override: 90.20%;
    descent-override: 22.48%;
    line-gap-override: 0.00%;
    size-adjust: 107.40%;
}

/* --font-face is kept for Nextcloud JS/CSS that reads the variable, but  */
/* we never use var(--font-face) in our own font-family declarations —    */
/* see class docblock for the reason.                                     */

:root {
    --font-face: 'InterVariable','InterVariable Fallback',-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
}

/*
 * Selectors prefixed with :root raise specificity from (0,0,1) to
 * (0,1,1), so our !important rules win even when Nextcloud's guest
 * or theming CSS appears later in source order with the same property.
 */
:root,
:root body,
:root button,
:root input,
:root optgroup,
:root option,
:root select,
:root textarea,
:root [contenteditable] {
    font-family: 'InterVariable','InterVariable Fallback',-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol" !important;
    font-feature-settings: 'liga' 1, 'calt' 1; /* contextual alternates, Chrome needs explicit opt-in */
}

/*
 * Restore monospace on code-like elements. The :root [contenteditable] rule
 * above declares font-family !important on rich-text editor roots; that value
 * is inherited into every descendant, overriding the user agent's monospace
 * default on <pre>, <code>, <kbd>, <samp>. Without this rule, code blocks in
 * the Text app's markdown editor (ProseMirror) and inline code in Notes,
 * Talk's composer, and Collectives render in Inter. Issue #9.
 *
 * The font-family below MUST match Nextcloud core verbatim. Nextcloud's
 * core/css/styles.scss declares a single hardcoded rule on `code`:
 *   code { font-family: 'Lucida Console','Lucida Sans Typewriter',
 *                       'DejaVu Sans Mono', monospace; }
 * It is not exposed as a CSS custom property, so we cannot inherit it via
 * var(); the only way to stay visually consistent with the rest of the UI is
 * to repeat the stack here. Stable on NC v32 and v33; unchanged on master.
 * Extending the same stack to <pre>, <kbd>, <samp>, and CodeMirror surfaces
 * makes them consistent with <code> too — core leaves those at the UA
 * default monospace, and our stack still ends in `monospace`, so the worst
 * case is identical to UA behaviour on systems without Lucida.
 *
 * font-feature-settings is reset so Inter's ligatures and contextual
 * alternates (e.g. ==, !=, => joined glyphs) cannot leak into code regions
 * regardless of whether they sit inside a contenteditable.
 *
 * The :root [contenteditable] code, … duplicates exist on purpose: they
 * match the specificity of the inherited override (0,1,1) at the descendant
 * level and appear later in source order, so they remain robust against any
 * future Nextcloud rule that targets code inside an editor with !important.
 */
:root pre,
:root code,
:root kbd,
:root samp,
:root tt,
:root .cm-content,
:root .cm-content *,
:root [contenteditable] pre,
:root [contenteditable] code,
:root [contenteditable] kbd,
:root [contenteditable] samp {
    font-family: "Lucida Console","Lucida Sans Typewriter",
                 "DejaVu Sans Mono",monospace !important;
    font-feature-settings: normal !important;
    font-variant-numeric: normal;
}

/*
 * Cover every Nextcloud surface that is styled independently,
 * including the login page (.guest-box, #body-login, .body-login-container)
 * and the Impersonate / Guests apps which inherit those surfaces.
 */
:root #header,
:root .header-left,
:root .header-right,
:root .header-menu,
:root #app-navigation,
:root #app-navigation-vue,
:root #app-content,
:root #app-content-vue,
:root #app-sidebar,
:root #app-sidebar-vue,
:root .modal-container,
:root .modal-wrapper,
:root .popover,
:root .popover__inner,
:root .tooltip,
:root .toastify,
:root .body-login-container,
:root #body-login,
:root .guest-box,
:root .update,
:root .nc-chip,
:root .breadcrumb,
:root .breadcrumb__crumb,
:root .file-picker,
:root .filepicker,
:root .sharing-entry,
:root .action-button,
:root .action-input,
:root .action-link,
:root .action-text,
:root .empty-content,
:root .emptycontent,
:root table, :root th, :root td {
    font-family: 'InterVariable','InterVariable Fallback',-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol" !important;
}

/* Pin bold weight to 700. The user agent sets font-weight: bolder on
 * <strong> and <b>, which is a relative keyword — it resolves to the next
 * bolder weight above the inherited value and can produce 800 or 900 with
 * a variable font. Author rules beat the user agent without !important,
 * so we keep this unforced to allow per-component overrides downstream. */
:root strong, :root b {
    font-weight: 700;
}

/* Inter ships true italics in the variable font */
:root em, :root i, :root cite, :root dfn, :root var, :root address, :root .italic {
    font-style: italic;
    font-family: 'InterVariable','InterVariable Fallback',-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol" !important;
}

/* Headings: let the variable font handle optical sizing */
:root h1, :root h2, :root h3, :root h4, :root h5, :root h6 {
    font-optical-sizing: auto;
}

/* Tabular numerals for columns where digits must align vertically */
:root .files-list,
:root .files-list__row,
:root .files-filestable,
:root .files-filestable td,
:root .filesize,
:root time,
:root .modified,
:root .date,
:root .dashboard-widget__item__time {
    font-variant-numeric: tabular-nums;
}