html, body {
    height: 100%;
}

/* The whole app is drawn a fifth larger than a browser's default, the same scale as the
   other *Flex apps. Every size is in `rem`, so this one number is the app's scale. A
   percentage rather than pixels so a reader's own larger default font still counts.

   Media queries cannot use it: `rem` inside a media query is always the browser's
   initial 16px. So every breakpoint here 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%;
}

/* A phone has no room to spare for the extra fifth. */
@media (max-width: 647.98px) {
    :root {
        font-size: 100%;
    }
}

/* TimeFlex theme: deep night-sky ink with an amber "sun" accent and an indigo "night"
   one - the two halves of the mark. Dark is the default (a wall of clocks is mostly
   looked at, often all day, on a screen in a room); 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 on bare `:root` so no colour exists only inside a media query. */
:root {
    color-scheme: dark;
    --tm-bg: #0a0e17;
    --tm-surface: #121929;
    --tm-surface-2: #19223a;
    --tm-chrome: #080b13;
    --tm-chrome-2: #0d121e;
    --tm-hover: #1c2640;
    --tm-border: #26324e;
    --tm-border-soft: #1a2339;
    --tm-text: #e8ecf5;
    --tm-muted: #919cb6;
    --tm-faint: #5d6886;
    --tm-accent: #f5b23d;
    --tm-accent-bright: #ffc65c;
    --tm-accent-ink: #2b1a00;
    --tm-accent-dim: rgba(245, 178, 61, 0.45);
    --tm-accent-wash: rgba(245, 178, 61, 0.13);
    --tm-night: #9399ff;
    --tm-night-wash: rgba(147, 153, 255, 0.15);
    --tm-dusk: #ff8a5c;
    --tm-dusk-wash: rgba(255, 138, 92, 0.15);
    --tm-danger: #f2777a;
    --tm-ok: #4fcf8e;

    /* A card's background is the sky there (wall.css). Dawn, dusk and night are the
       same in both themes; the daytime sky follows the theme, and so does the frosted
       panel the details sit on. */
    --tm-sky-day: linear-gradient(180deg, #1b5aa6 0%, #3a86cf 55%, #79b6e6 100%);
    --tm-sky-day-ink: #ffffff;
    --tm-sky-day-muted: rgba(255, 255, 255, 0.84);
    --tm-sky-day-line: rgba(255, 255, 255, 0.4);
    --tm-sky-day-pill: rgba(8, 30, 70, 0.28);
    --tm-sky-day-shadow: 0 1px 2px rgba(0, 20, 60, 0.35);
    --tm-sky-day-grey: #5d6b80;
    --tm-panel: rgba(13, 19, 33, 0.76);

    /* Faces. The digital display and the flaps stay dark in both themes, the way real
       ones are; the dial follows the theme. These are the defaults - css/wall.css
       works out the rest from them, and a clock can choose its own colours. */
    --tm-dial: #0e1424;
    --tm-dial-ink: #edf0f7;
    --tm-lcd-bg: #06080f;
    --tm-lcd-on: #ffb938;
    --tm-flap: #1a1e26;
    --tm-flap-ink: #f4f5f7;
    --tm-flap-hinge: #04060a;

    --tm-shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 10px 30px rgba(0, 0, 0, 0.28);
    --tm-shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.02);
}

/* 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. TimeFlex calls its pane "surface". */
:root {
    --tm-statusbar-h: 1.6rem;

    --fxm-pane: var(--tm-surface);
    --fxm-pane-alt: var(--tm-chrome-2);
    --fxm-field: var(--tm-chrome-2);
    --fxm-hover: var(--tm-hover);
    --fxm-border: var(--tm-border);
    --fxm-border-soft: var(--tm-border-soft);
    --fxm-text: var(--tm-text);
    --fxm-muted: var(--tm-muted);
    --fxm-faint: var(--tm-faint);
    --fxm-danger: var(--tm-danger);
    --fxm-accent: var(--tm-accent);
    --fxm-accent-dim: var(--tm-accent-dim);
    --fxm-accent-wash: var(--tm-accent-wash);
    --fxm-statusbar-h: var(--tm-statusbar-h);
}

:root[data-theme="light"] {
    color-scheme: light;
    --tm-bg: #edf0f6;
    --tm-surface: #ffffff;
    --tm-surface-2: #f4f6fa;
    --tm-chrome: #f7f8fb;
    --tm-chrome-2: #f0f3f8;
    --tm-hover: #e5e9f1;
    --tm-border: #d2d9e6;
    --tm-border-soft: #e2e7f0;
    --tm-text: #151b29;
    --tm-muted: #586379;
    --tm-faint: #99a2b5;
    --tm-accent: #b46700;
    --tm-accent-bright: #cc7a04;
    --tm-accent-ink: #ffffff;
    --tm-accent-dim: rgba(180, 103, 0, 0.45);
    --tm-accent-wash: rgba(220, 140, 20, 0.12);
    --tm-night: #4a52d4;
    --tm-night-wash: rgba(74, 82, 212, 0.1);
    --tm-dusk: #d2582a;
    --tm-dusk-wash: rgba(210, 88, 42, 0.1);
    --tm-danger: #c02f33;
    --tm-ok: #1d8a4f;

    --tm-sky-day: linear-gradient(180deg, #6db4ef 0%, #a7d4f6 55%, #e0f1fd 100%);
    --tm-sky-day-ink: #0b2541;
    --tm-sky-day-muted: rgba(11, 37, 65, 0.76);
    --tm-sky-day-line: rgba(11, 37, 65, 0.28);
    --tm-sky-day-pill: rgba(255, 255, 255, 0.5);
    --tm-sky-day-shadow: none;
    --tm-sky-day-grey: #8f9cad;
    --tm-panel: rgba(255, 255, 255, 0.9);

    --tm-dial: #ffffff;
    --tm-dial-ink: #151b29;
    --tm-lcd-bg: #10141d;
    --tm-lcd-on: #ffb938;
    --tm-flap: #1d2129;
    --tm-flap-ink: #f6f7f9;
    --tm-flap-hinge: #05070b;

    --tm-shadow: 0 1px 2px rgba(21, 27, 41, 0.05), 0 8px 24px rgba(21, 27, 41, 0.06);
    --tm-shadow-pop: 0 18px 50px rgba(21, 27, 41, 0.18), 0 0 0 1px rgba(21, 27, 41, 0.04);
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --tm-bg: #edf0f6;
        --tm-surface: #ffffff;
        --tm-surface-2: #f4f6fa;
        --tm-chrome: #f7f8fb;
        --tm-chrome-2: #f0f3f8;
        --tm-hover: #e5e9f1;
        --tm-border: #d2d9e6;
        --tm-border-soft: #e2e7f0;
        --tm-text: #151b29;
        --tm-muted: #586379;
        --tm-faint: #99a2b5;
        --tm-accent: #b46700;
        --tm-accent-bright: #cc7a04;
        --tm-accent-ink: #ffffff;
        --tm-accent-dim: rgba(180, 103, 0, 0.45);
        --tm-accent-wash: rgba(220, 140, 20, 0.12);
        --tm-night: #4a52d4;
        --tm-night-wash: rgba(74, 82, 212, 0.1);
        --tm-dusk: #d2582a;
        --tm-dusk-wash: rgba(210, 88, 42, 0.1);
        --tm-danger: #c02f33;
        --tm-ok: #1d8a4f;

        --tm-sky-day: linear-gradient(180deg, #6db4ef 0%, #a7d4f6 55%, #e0f1fd 100%);
        --tm-sky-day-ink: #0b2541;
        --tm-sky-day-muted: rgba(11, 37, 65, 0.76);
        --tm-sky-day-line: rgba(11, 37, 65, 0.28);
        --tm-sky-day-pill: rgba(255, 255, 255, 0.5);
        --tm-sky-day-shadow: none;
        --tm-sky-day-grey: #8f9cad;
        --tm-panel: rgba(255, 255, 255, 0.9);

        --tm-dial: #ffffff;
        --tm-dial-ink: #151b29;
        --tm-lcd-bg: #10141d;
        --tm-lcd-on: #ffb938;
        --tm-flap: #1d2129;
        --tm-flap-ink: #f6f7f9;
        --tm-flap-hinge: #05070b;

        --tm-shadow: 0 1px 2px rgba(21, 27, 41, 0.05), 0 8px 24px rgba(21, 27, 41, 0.06);
        --tm-shadow-pop: 0 18px 50px rgba(21, 27, 41, 0.18), 0 0 0 1px rgba(21, 27, 41, 0.04);
    }
}

body {
    margin: 0;
    background: var(--tm-bg);
    color: var(--tm-text);
    font-family: 'Inter', 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* The app and an exported wall own the viewport; nothing outside them should scroll. */
body:has(.tm-shell),
body.tm-export {
    overflow: hidden;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
