/*
 * SnarlScribe shell theme (B-014, D-057, D-078), laid over Radzen's standard-dark.
 *
 * Two layers:
 *   1. --sc-* tokens: the neutral shell's values on :root. A game theme file
 *      (in that game's RCL) redefines them under [data-game="<key>"].
 *   2. One mapping block that points Radzen's --rz-* variables at the tokens.
 *      It is declared on ":root, [data-game]" so it is evaluated again on a
 *      game's wrapper: a var() inside a custom property is resolved where the
 *      property is declared, so a game that only changed the tokens would
 *      otherwise keep the root's colors.
 *
 * The look imitates Radzen's paid Zen Dark (flat, monochrome, no shadows,
 * rounder corners) from observation of its demo site. Radzen's own Zen
 * stylesheet is never copied (B-014). The shell is monochrome: its "accent" is
 * near-white, as in Zen Dark. A game theme brings its own accent (Repent: the
 * purple of its cover).
 */
:root {
    --sc-bg: #181818;
    --sc-surface: #242424;
    --sc-raised: #313131;
    --sc-border: #585858;
    --sc-muted: #6a6a6a;
    --sc-ink: #e6e6e6;
    --sc-ink-dim: #c4c4c4;
    --sc-ink-faint: #a0a0a0;
    --sc-accent: #e6e6e6;
    --sc-accent-hover: #c4c4c4;
    --sc-accent-text: #e6e6e6;
    --sc-on-accent: #181818;
    --sc-radius: 8px;
    --sc-radius-btn: 12px;
    --sc-radius-card: 16px;
    --sc-font-body: 'Ubuntu', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --sc-font-head: var(--sc-font-body);
    --sc-font-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;

    /* B-074: our own small text, one step up from the 14px and 12px it was. */
    --sc-text-small: 0.9375rem;
    --sc-text-tiny: 0.8125rem;

    /* Texture and ragged edges: none in the shell, set by a game theme. */
    --sc-grain: none;
    --sc-cut: none;
    --sc-cut-btn: none;
    --sc-cut-chip: none;
    --sc-cut-strip: none;
}

/* B-082: 16px still read as small, so the root is 18px (as a percentage, so a reader's own browser size still counts).
   Every size in the app is in rem, so text, spacing and tap targets all grow together. Radzen's theme sets the root
   size from this variable on :root, which beats a plain html rule, so the variable is what has to change. */
:root {
    --rz-root-font-size: 112.5%;
}

:root,
[data-game] {
    --rz-text-font-family: var(--sc-font-body);
    /* B-074: Radzen's body text is 14px; ours is 16px, and the smaller styles move up with it. */
    --rz-body-font-size: 1rem;
    --rz-text-body2-font-size: 1rem;
    --rz-text-subtitle2-font-size: 1rem;
    --rz-text-caption-font-size: 0.875rem;
    --rz-text-button-font-size: 0.9375rem;
    --rz-text-overline-font-size: 0.75rem;

    --rz-base-900: var(--sc-bg);
    --rz-base-800: var(--sc-surface);
    --rz-base-700: var(--sc-raised);
    --rz-base-600: var(--sc-border);
    --rz-base-500: var(--sc-muted);
    --rz-base-400: var(--sc-ink-faint);
    --rz-base-300: var(--sc-ink-dim);
    --rz-base-100: var(--sc-ink);
    --rz-body-background-color: var(--sc-bg);
    --rz-base-background-color: var(--sc-surface);
    --rz-header-background-color: var(--sc-surface);
    --rz-card-flat-background-color: var(--sc-surface);
    --rz-text-color: var(--sc-ink);
    --rz-text-secondary-color: var(--sc-ink-dim);
    --rz-text-tertiary-color: var(--sc-ink-faint);

    --rz-primary: var(--sc-accent);
    --rz-primary-light: var(--sc-accent-text);
    --rz-primary-lighter: color-mix(in srgb, var(--sc-accent) 22%, transparent);
    --rz-primary-dark: var(--sc-accent-hover);
    --rz-primary-darker: var(--sc-accent-hover);
    --rz-on-primary: var(--sc-on-accent);
    --rz-on-primary-light: var(--sc-on-accent);
    --rz-on-primary-dark: var(--sc-on-accent);
    --rz-on-primary-darker: var(--sc-on-accent);
    --rz-on-primary-lighter: var(--sc-accent-text);
    --rz-outline-color: var(--sc-accent-text);
    /* Radzen bakes the blue into this instead of deriving it from --rz-primary. */
    --rz-input-focus-shadow: 0 0 0 1px var(--sc-bg), 0 0 0 3px color-mix(in srgb, var(--sc-accent) 45%, transparent);

    /* Radzen's navy secondary has no place in a monochrome shell. */
    --rz-secondary: var(--sc-raised);
    --rz-secondary-light: var(--sc-border);
    --rz-secondary-lighter: color-mix(in srgb, var(--sc-raised) 50%, transparent);
    --rz-secondary-dark: var(--sc-surface);
    --rz-secondary-darker: var(--sc-bg);
    --rz-on-secondary: var(--sc-ink);
    --rz-on-secondary-light: var(--sc-ink);
    --rz-on-secondary-lighter: var(--sc-ink);
    --rz-on-secondary-dark: var(--sc-ink);
    --rz-on-secondary-darker: var(--sc-ink);

    /* Flat: no gradients on button hover, focus or press; no shadows. */
    --rz-button-hover-gradient: none;
    --rz-button-focus-gradient: none;
    --rz-button-active-gradient: none;
    --rz-card-shadow: none;
    --rz-header-shadow: none;
    --rz-header-border: 1px solid var(--sc-border);

    --rz-link-text-decoration: underline;
    --rz-border-radius: var(--sc-radius);
    --rz-button-border-radius: var(--sc-radius-btn);
    --rz-card-border-radius: var(--sc-radius-card);
    --rz-card-border: 1px solid var(--sc-border);
}

body {
    background: var(--sc-bg);
    color: var(--sc-ink);
    font-family: var(--sc-font-body);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--sc-accent-text);
}

::selection {
    background: var(--sc-accent);
    color: var(--sc-on-accent);
}

/* Where the tokens above are used outside Radzen's own variables. */
h1, h2, h3, h4, h5, h6,
.rz-text-h1, .rz-text-h2, .rz-text-h3, .rz-text-h4, .rz-text-h5, .rz-text-h6 {
    font-family: var(--sc-font-head);
}

.rz-body,
.rz-sidebar {
    background-image: var(--sc-grain);
}

.rz-header {
    clip-path: var(--sc-cut-strip);
}

.rz-button {
    clip-path: var(--sc-cut-btn);
}

.rz-card {
    clip-path: var(--sc-cut);
}
