html, body {
    height: 100%;
}

/* The whole app is drawn a fifth larger than a browser's default, the same scale as
   TextFlex, JwtFlex and CronFlex - the *Flex apps are drawn at one size.

   Every size in this app is in `rem`, so this one number is the app's scale and nothing
   else has to know about it - change it and the type, the panes and the tables all move
   together. A percentage rather than a pixel count so that a reader who has already set
   a larger default font in their browser keeps the increase.

   The media queries are the exception and cannot use it: `rem` inside a media query is
   always the browser's initial 16px, whatever this says. So every breakpoint in this app
   is written at 1.2x the width it would otherwise be - the content is 1.2x, so it runs
   out of room 1.2x sooner. */
:root {
    font-size: 120%;
}

/* DiffFlex theme.
   Dark is the default (this is a workbench, and it is what most users of it
   want); light applies when the user picks it, or when the system asks for it
   and the user has not overridden that. Every token is defined here on bare
   `:root` so no colour exists only inside a media query. */
:root {
    color-scheme: dark;
    --df-bg: #0d1015;
    --df-pane: #15191f;
    --df-pane-alt: #11151a;
    --df-chrome: #0a0d11;
    --df-chrome-2: #12161c;
    --df-chrome-hover: #1e242d;
    --df-border: #262f3a;
    --df-border-soft: #1a212a;
    --df-text: #dde5ee;
    --df-muted: #8391a2;
    --df-faint: #56626f;
    --df-accent: #e46fc8;
    --df-accent-bright: #f08bd8;
    --df-accent-ink: #2e0a24;
    --df-accent-dim: rgba(228, 111, 200, 0.45);
    --df-accent-wash: rgba(228, 111, 200, 0.14);

    --df-danger: #f2777a;

    /* One hue per side of the comparison. */
    --df-side-left: #4cb7ec;
    --df-side-right: #e8a33c;

    /* What the comparison found. A wash for the whole line, and a stronger one for the
       words inside it that changed; removed is the left's colour, added the right's. */
    --df-del: #f2777a;
    --df-del-wash: rgba(242, 119, 122, 0.12);
    --df-del-strong: rgba(242, 119, 122, 0.36);
    --df-add: #4fcf8e;
    --df-add-wash: rgba(79, 207, 142, 0.11);
    --df-add-strong: rgba(79, 207, 142, 0.32);
    --df-minor-wash: rgba(131, 145, 162, 0.10);
    --df-minor-strong: rgba(131, 145, 162, 0.28);
    --df-filler: rgba(131, 145, 162, 0.07);

    --df-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* The FlexTools menu, Feedback and the privacy sheet (css/tools-menu.css, css/feedback.css and
   css/privacy-sheet.css, the same files in every tool) in this tool's colours. Only references, so
   the light theme below carries straight through. */
:root {
    --fxm-pane: var(--df-pane);
    --fxm-pane-alt: var(--df-pane-alt);
    --fxm-field: var(--df-chrome-2);
    --fxm-hover: var(--df-chrome-hover);
    --fxm-border: var(--df-border);
    --fxm-border-soft: var(--df-border-soft);
    --fxm-text: var(--df-text);
    --fxm-muted: var(--df-muted);
    --fxm-faint: var(--df-faint);
    --fxm-danger: var(--df-danger);
    --fxm-accent: var(--df-accent);
    --fxm-accent-dim: var(--df-accent-dim);
    --fxm-accent-wash: var(--df-accent-wash);
    --fxm-statusbar-h: var(--df-statusbar-h);
}

:root[data-theme="light"] {
    color-scheme: light;
    --df-bg: #e7ebf0;
    --df-pane: #ffffff;
    --df-pane-alt: #f7f9fb;
    --df-chrome: #f9fbfc;
    --df-chrome-2: #f1f4f7;
    --df-chrome-hover: #e4e9ef;
    --df-border: #ccd5df;
    --df-border-soft: #dde4eb;
    --df-text: #18202a;
    --df-muted: #5a6673;
    --df-faint: #98a3af;
    --df-accent: #b02a93;
    --df-accent-bright: #c23aa5;
    --df-accent-ink: #ffffff;
    --df-accent-dim: rgba(176, 42, 147, 0.45);
    --df-accent-wash: rgba(176, 42, 147, 0.09);

    --df-danger: #c02f33;

    --df-side-left: #1a86c4;
    --df-side-right: #b3711a;

    --df-del: #c02f33;
    --df-del-wash: rgba(214, 60, 64, 0.09);
    --df-del-strong: rgba(214, 60, 64, 0.24);
    --df-add: #1d8a4f;
    --df-add-wash: rgba(36, 160, 92, 0.10);
    --df-add-strong: rgba(36, 160, 92, 0.26);
    --df-minor-wash: rgba(90, 102, 115, 0.08);
    --df-minor-strong: rgba(90, 102, 115, 0.20);
    --df-filler: rgba(90, 102, 115, 0.06);

    --df-shadow: 0 1px 2px rgba(24, 32, 42, 0.06);
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --df-bg: #e7ebf0;
        --df-pane: #ffffff;
        --df-pane-alt: #f7f9fb;
        --df-chrome: #f9fbfc;
        --df-chrome-2: #f1f4f7;
        --df-chrome-hover: #e4e9ef;
        --df-border: #ccd5df;
        --df-border-soft: #dde4eb;
        --df-text: #18202a;
        --df-muted: #5a6673;
        --df-faint: #98a3af;
        --df-accent: #b02a93;
        --df-accent-bright: #c23aa5;
        --df-accent-ink: #ffffff;
        --df-accent-dim: rgba(176, 42, 147, 0.45);
        --df-accent-wash: rgba(176, 42, 147, 0.09);

        --df-danger: #c02f33;

        --df-side-left: #1a86c4;
        --df-side-right: #b3711a;

        --df-del: #c02f33;
        --df-del-wash: rgba(214, 60, 64, 0.09);
        --df-del-strong: rgba(214, 60, 64, 0.24);
        --df-add: #1d8a4f;
        --df-add-wash: rgba(36, 160, 92, 0.10);
        --df-add-strong: rgba(36, 160, 92, 0.26);
        --df-minor-wash: rgba(90, 102, 115, 0.08);
        --df-minor-strong: rgba(90, 102, 115, 0.20);
        --df-filler: rgba(90, 102, 115, 0.06);

        --df-shadow: 0 1px 2px rgba(24, 32, 42, 0.06);
    }
}

/* The workbench owns the viewport; nothing outside it should scroll. */
body:has(.df-shell) {
    overflow: hidden;
    margin: 0;
    background: var(--df-bg);
}

/* A standing document scrolls, so the page background has to be the theme's rather than
   the browser's white - otherwise overscroll, and any gap under a short document, flashes
   white behind a dark page. Set on body rather than on the .doc element itself, because it
   is body's background that propagates to the canvas the overscroll paints. */
body:has(.doc) {
    margin: 0;
    background: var(--df-bg);
}
