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%;
}

/* FormatFlex theme: teal on deep ink.
   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.

   The --ff-syn-* tokens colour the formatted text, one per kind of token the languages
   produce. They are picked to be told apart at a glance - names (keys, tags) cool,
   values (strings, numbers) warm - and to stay readable on the pane at small sizes. */
:root {
    color-scheme: dark;
    --ff-bg: #0b1012;
    --ff-pane: #11181b;
    --ff-pane-alt: #0e1417;
    --ff-chrome: #091013;
    --ff-chrome-2: #0f171a;
    --ff-chrome-hover: #1a262a;
    --ff-border: #223138;
    --ff-border-soft: #172327;
    --ff-text: #d9e6e8;
    --ff-muted: #829aa0;
    --ff-faint: #51676c;
    --ff-accent: #2fc8b4;
    --ff-accent-bright: #5ddccb;
    --ff-accent-ink: #032420;
    --ff-accent-dim: rgba(47, 200, 180, 0.45);
    --ff-accent-wash: rgba(47, 200, 180, 0.13);

    --ff-danger: #f47b6f;
    --ff-danger-wash: rgba(244, 123, 111, 0.14);
    --ff-ok: #5fd39a;

    --ff-syn-key: #74c7ff;
    --ff-syn-str: #b5dc84;
    --ff-syn-num: #f7a76c;
    --ff-syn-lit: #ff8fa3;
    --ff-syn-kw: #c49bff;
    --ff-syn-type: #5ddccb;
    --ff-syn-fn: #ffd479;
    --ff-syn-com: #62797f;
    --ff-syn-tag: #ff8f7a;
    --ff-syn-attr: #f2c46d;
    --ff-syn-punc: #8ba2a8;
    --ff-syn-meta: #9aa9ff;

    --ff-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(--ff-pane);
    --fxm-pane-alt: var(--ff-pane-alt);
    --fxm-field: var(--ff-chrome-2);
    --fxm-hover: var(--ff-chrome-hover);
    --fxm-border: var(--ff-border);
    --fxm-border-soft: var(--ff-border-soft);
    --fxm-text: var(--ff-text);
    --fxm-muted: var(--ff-muted);
    --fxm-faint: var(--ff-faint);
    --fxm-danger: var(--ff-danger);
    --fxm-accent: var(--ff-accent);
    --fxm-accent-dim: var(--ff-accent-dim);
    --fxm-accent-wash: var(--ff-accent-wash);
    --fxm-statusbar-h: var(--ff-statusbar-h);
}

:root[data-theme="light"] {
    color-scheme: light;
    --ff-bg: #e6eded;
    --ff-pane: #ffffff;
    --ff-pane-alt: #f5f9f9;
    --ff-chrome: #f8fbfb;
    --ff-chrome-2: #eef4f4;
    --ff-chrome-hover: #e0e9e9;
    --ff-border: #c6d4d6;
    --ff-border-soft: #d9e4e5;
    --ff-text: #132124;
    --ff-muted: #50666b;
    --ff-faint: #91a4a8;
    --ff-accent: #0a8576;
    --ff-accent-bright: #0b9988;
    --ff-accent-ink: #ffffff;
    --ff-accent-dim: rgba(10, 133, 118, 0.45);
    --ff-accent-wash: rgba(10, 133, 118, 0.09);

    --ff-danger: #c63a2f;
    --ff-danger-wash: rgba(198, 58, 47, 0.09);
    --ff-ok: #1a8a52;

    --ff-syn-key: #0b62a8;
    --ff-syn-str: #3d7a12;
    --ff-syn-num: #b5530a;
    --ff-syn-lit: #c0264d;
    --ff-syn-kw: #7a3fd6;
    --ff-syn-type: #08776a;
    --ff-syn-fn: #8a5a00;
    --ff-syn-com: #7d9196;
    --ff-syn-tag: #c0392b;
    --ff-syn-attr: #946200;
    --ff-syn-punc: #5a7075;
    --ff-syn-meta: #4d55c9;

    --ff-shadow: 0 1px 2px rgba(19, 33, 36, 0.06);
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --ff-bg: #e6eded;
        --ff-pane: #ffffff;
        --ff-pane-alt: #f5f9f9;
        --ff-chrome: #f8fbfb;
        --ff-chrome-2: #eef4f4;
        --ff-chrome-hover: #e0e9e9;
        --ff-border: #c6d4d6;
        --ff-border-soft: #d9e4e5;
        --ff-text: #132124;
        --ff-muted: #50666b;
        --ff-faint: #91a4a8;
        --ff-accent: #0a8576;
        --ff-accent-bright: #0b9988;
        --ff-accent-ink: #ffffff;
        --ff-accent-dim: rgba(10, 133, 118, 0.45);
        --ff-accent-wash: rgba(10, 133, 118, 0.09);

        --ff-danger: #c63a2f;
        --ff-danger-wash: rgba(198, 58, 47, 0.09);
        --ff-ok: #1a8a52;

        --ff-syn-key: #0b62a8;
        --ff-syn-str: #3d7a12;
        --ff-syn-num: #b5530a;
        --ff-syn-lit: #c0264d;
        --ff-syn-kw: #7a3fd6;
        --ff-syn-type: #08776a;
        --ff-syn-fn: #8a5a00;
        --ff-syn-com: #7d9196;
        --ff-syn-tag: #c0392b;
        --ff-syn-attr: #946200;
        --ff-syn-punc: #5a7075;
        --ff-syn-meta: #4d55c9;

        --ff-shadow: 0 1px 2px rgba(19, 33, 36, 0.06);
    }
}

/* The mark (Pages/Shared/_Mark.cshtml), wherever it is drawn: teal braces around grey
   lines, the indented one in the text colour. */
.brand-mark,
.doc-mark {
    flex: none;
    fill: none;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ff-mark-brace {
    stroke: var(--ff-accent);
}

.ff-mark-line {
    stroke: var(--ff-muted);
}

.ff-mark-indent {
    stroke: var(--ff-text);
}

/* The workbench owns the viewport; nothing outside it should scroll. */
body:has(.ff-shell) {
    overflow: hidden;
    margin: 0;
    background: var(--ff-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(--ff-bg);
}
