/*
 * Quiet Premium — theme layer.
 *
 * This theme's job is to preserve the existing storefront, so it restyles nothing.
 * What it does do is bind the platform's design variables to the theme tokens, and
 * that binding is the whole point: it is what makes an Admin appearance change
 * visible without a rebuild.
 *
 * The platform stylesheet (resources/css/style.css) declares the concrete values on
 * --bg, --surface, --text and friends. This file re-points those names at the
 * --gsm-* tokens emitted by @themeTokens, so:
 *
 *   admin sets gsm-color-text = #ff0000
 *     → --text resolves to #ff0000
 *       → every rule in style.css that reads var(--text) follows.
 *
 * Two properties of the arrangement are deliberate:
 *
 *  - The token names live in the :root block written by @themeTokens, and the
 *    fallbacks in the var() calls repeat those same defaults. If the theme token
 *    block is missing entirely — no theme active, or the inline style stripped —
 *    the page still resolves to the values in style.css rather than to nothing.
 *  - Only names are rebound. No rule in this file sets a colour, radius or font
 *    directly, so there is no second source of truth to drift out of sync.
 */

:root {
    /* Surfaces. The platform distinguishes the page background from the raised
       surfaces; the theme vocabulary has one surface pair, so the page background
       is derived from the base surface by mixing toward it. */
    --bg: var(--gsm-color-surface, #101010);
    --surface: var(--gsm-color-surface, #101010);
    --surface-2: var(--gsm-color-surface-2, #181818);
    --surface-3: color-mix(in srgb, var(--gsm-color-surface-2, #181818) 70%, var(--gsm-color-text, #f5f5f5) 8%);

    /* Ink. */
    --text: var(--gsm-color-text, #f5f5f5);
    --text-muted: var(--gsm-color-text-muted, #8a8a8a);
    --text-secondary: color-mix(in srgb, var(--gsm-color-text, #f5f5f5) 78%, transparent);

    /* Lines. */
    --border: var(--gsm-color-border, #262626);
    --border-strong: color-mix(in srgb, var(--gsm-color-border, #262626) 70%, var(--gsm-color-text, #f5f5f5) 14%);

    /* Accent, and the ink that has to stay legible on top of it. */
    --accent: var(--gsm-color-primary, #ffffff);
    --accent-contrast: var(--gsm-color-primary-contrast, #000000);

    /* Shape. */
    --radius-btn: var(--gsm-radius-button, 14px);
    --radius-card: var(--gsm-radius-card, 20px);

    /* Measure. */
    --container-max-width: var(--gsm-container-max-width, 1280px);
}

/*
 * The dark block. The storefront renders `class="dark"` on <html> by default, and
 * the theme toggle moves between the two, so the tokens that differ between modes
 * are rebound here as well. Only the values that genuinely differ are listed —
 * anything absent inherits from :root, which is what keeps the two blocks from
 * drifting into disagreement.
 */
.dark {
    --bg: var(--gsm-color-surface, #0f0f11);
    --surface: var(--gsm-color-surface, #0f0f11);
    --surface-2: var(--gsm-color-surface-2, #17171a);
    --text: var(--gsm-color-text, #f4f4f5);
    --text-muted: var(--gsm-color-text-muted, #a1a1aa);
    --border: var(--gsm-color-border, #2a2a2e);
}

/*
 * Light mode is the same mapping against the same tokens, which means switching
 * the toggle changes the token block rather than swapping stylesheets. An operator
 * who sets a light-mode surface sees it applied the moment the toggle is used.
 */
:root:not(.dark) {
    --bg: var(--gsm-color-surface, #ffffff);
    --surface: var(--gsm-color-surface, #ffffff);
    --surface-2: var(--gsm-color-surface-2, #f7f7f8);
    --text: var(--gsm-color-text, #1b1b1d);
    --text-muted: var(--gsm-color-text-muted, #6b6b70);
    --border: var(--gsm-color-border, #e4e4e7);
}
