/*
 * base.css — framework-level token contract.
 *
 * Loaded from index.html before any palette/layout. Contains ONLY :root
 * variable defaults; no element / class / id rules. With no palette and
 * no layout selected, the page renders as plain HTML on top of these
 * neutral defaults.
 *
 *   ## Framework state attributes (theme-readable, no class invention)
 *
 *   Themes set standard `data-tapp-<concept>` attributes on any element
 *   instead of adding bespoke classes. Layout CSS reads them via
 *   `[data-tapp-launcher="active"]`-style selectors.
 *
 *   Convention:
 *     - **Attribute name = concept** (e.g. `data-tapp-launcher`).
 *       Each concept is owned by exactly one widget/affordance and
 *       lives in this framework-level list. Themes should not invent
 *       new concept attributes without promoting them here first.
 *     - **Attribute value = state within that concept**, short and
 *       reusable across concepts (`peeked`, `active`, `open`, `closed`).
 *     - Absence of the attribute is the rest state.
 *
 *   Concepts in current use (extend by editing this list):
 *     data-tapp-launcher        App launcher / spotlight panel.
 *                               Values: 'peeked' (hover-poised),
 *                                       'active' (open / engaged).
 *                               Typically set on :root by the layout.
 *     data-tapp-nav-expanded    Feature-nav (sidebar / strip) expansion
 *                               state. Boolean: 'true' = full labels,
 *                               anything else (or absent) = collapsed
 *                               (icon-only). Set on the
 *                               <nav class="tapp_feature_nav"> element by
 *                               whatever toggle the layout provides.
 *
 *   Layer order in index.html:
 *     1. base.css       (this file — neutral token defaults)
 *     2. palette.css    (brand overrides — chooses the colors)
 *     3. layout.css     (a layout's element rules — uses the tokens)
 *
 * Naming: --tapp_<group>-<role>. Groups in current use:
 *   brand-*           — brand identity colors (always overridden by palette)
 *   theme-*           — surfaces, text, links, borders, shadows
 *   theme-input-*     — input-control palette
 *   theme-button-*    — button palette (primary / secondary)
 *   menu-*            — module/feature menu palette
 *   status-*          — semantic status (success / error / warning / info)
 *   footer-*          — footer surface
 *   dialog-*          — dialog backdrop tints
 *   library-*         — library-picker dialog
 *   chart-*           — chart visuals (funnel, flowchart)
 *
 * Defaults here are deliberately neutral (system grays / generic blues)
 * so a "no-palette" boot still looks coherent.
 */

:root {
    /* Brand — overridden by every palette */
    --tapp_brand-primary: #444444;
    --tapp_brand-secondary: #888888;

    /* Surfaces & text */
    --tapp_theme-background: #ffffff;
    --tapp_theme-surface: #ffffff;
    --tapp_theme-surface-alt: #f5f5f5;
    --tapp_theme-text: #333333;
    --tapp_theme-text-muted: #888888;
    --tapp_theme-text-inverted: #ffffff;

    --tapp_theme-link: #2a6db4;
    --tapp_theme-link-hover: #1a4a82;
    --tapp_theme-border: #e0e0e0;
    --tapp_theme-border-light: rgba(0, 0, 0, 0.08);
    --tapp_theme-shadow: rgba(0, 0, 0, 0.12);

    /* Inputs */
    --tapp_theme-input-bg: #ffffff;
    --tapp_theme-input-border: #e0e0e0;
    --tapp_theme-input-text: #333333;
    --tapp_theme-input-placeholder: #888888;
    --tapp_theme-input-focus: #2a6db4;
    --tapp_theme-input-disabled: #f5f5f5;

    /* Buttons */
    --tapp_theme-button-primary-bg: #2a6db4;
    --tapp_theme-button-primary-text: #ffffff;
    --tapp_theme-button-primary-hover: #1a4a82;
    --tapp_theme-button-secondary-bg: #f5f5f5;
    --tapp_theme-button-secondary-text: #333333;
    --tapp_theme-button-secondary-hover: #e0e0e0;

    /* Menu */
    --tapp_menu-bg: #333333;
    --tapp_menu-bg-hover: #2a2a2a;
    --tapp_menu-bg-sub: #1f1f1f;
    --tapp_menu-text: #ffffff;
    --tapp_menu-border: rgba(255, 255, 255, 0.2);

    /* Status */
    --tapp_status-success: #28a745;
    --tapp_status-success-light: rgba(40, 167, 69, 0.1);
    --tapp_status-error: #dc3545;
    --tapp_status-error-light: rgba(220, 53, 69, 0.08);
    --tapp_status-warning: #ffc107;
    --tapp_status-warning-light: rgba(255, 193, 7, 0.1);
    --tapp_status-info: #2a6db4;
    --tapp_status-info-light: rgba(42, 109, 180, 0.1);

    /* Footer */
    --tapp_footer-bg: #52565c;
    --tapp_footer-text: #cccccc;

    /* Modal / dialog backdrop */
    --tapp_dialog-backdrop: rgba(0, 0, 0, 0.4);
    --tapp_dialog-backdrop-brand: rgba(0, 0, 0, 0.25);

    /* Input focus accent (halo around focused inputs) */
    --tapp_input-focus-shadow: rgba(42, 109, 180, 0.2);

    /* Section heading underline */
    --tapp_section-heading-border: rgba(0, 0, 0, 0.15);

    /* Library dialog (table-style picker) */
    --tapp_library-border: #d0d0d0;
    --tapp_library-row-hover: #f5f5f5;
    --tapp_library-row-selected: #e8e8e8;
    --tapp_library-text-secondary: #666666;

    /* Chart tokens — consumed by classic theme.css against the framework
       class contract emitted by charts.js (.tapp_flowchart_*, .tapp_funnel_*). */
    --tapp_chart-step-stroke: rgba(0, 0, 0, 0.10);
    --tapp_chart-step-text: #ffffff;
    --tapp_chart-step-text-halo: rgba(0, 0, 0, 0.45);
    --tapp_chart-flowchart-node-bg: #ffffff;
    --tapp_chart-flowchart-node-stroke: rgba(0, 0, 0, 0.18);
    --tapp_chart-flowchart-node-text: #222222;
    --tapp_chart-flowchart-demo-bg: #444444;
    --tapp_chart-flowchart-demo-stroke: rgba(0, 0, 0, 0.25);
    --tapp_chart-flowchart-demo-text: #ffffff;
    --tapp_chart-flowchart-edge-bg: #ffffff;
    --tapp_chart-flowchart-edge-stroke: rgba(0, 0, 0, 0.10);
    --tapp_chart-flowchart-edge-text: #444444;
    --tapp_chart-flowchart-link: #999999;
    --tapp_chart-flowchart-link-prev:   #c1352f;
    --tapp_chart-flowchart-link-inc:    #5fa9d3;
    --tapp_chart-flowchart-link-filter: #1c4e6f;
    /* Leaf nodes — emphasized as the terminal states in the flow. */
    --tapp_chart-flowchart-leaf-bg:     #000000;
    --tapp_chart-flowchart-leaf-stroke: #000000;
    --tapp_chart-flowchart-leaf-text:   #ffffff;

    /* Active-language indicator (next to #tapp_lang select). Each layout
       decides whether to render it (Drop = corner badge; Classic hides
       because the <select> already shows the value). */
    --tapp_active_lang-bg: var(--tapp_brand-primary);
    --tapp_active_lang-text: var(--tapp_theme-text-inverted);

    /* Categorical palette for charts that color by top-level branch
       (sunburst, treemap, etc.). Tokens override-able by palettes. */
    --tapp_chart-cat-1: #c1352f;
    --tapp_chart-cat-2: #e08c3c;
    --tapp_chart-cat-3: #e6c229;
    --tapp_chart-cat-4: #5fa9d3;
    --tapp_chart-cat-5: #3d8275;
    --tapp_chart-cat-6: #1c4e6f;
    --tapp_chart-cat-7: #984e83;
    --tapp_chart-cat-8: #a26769;
}

/* Pref toggles (animations, sound) — structural contract only. The
   markup mirrors the dark-theme toggle above: a <label class="tapp_label">
   + <label class="tapp_switch tapp_pref_switch"> wrapping a native
   checkbox. Plain HTML renders text + native checkbox; themes hide
   both and paint their own affordance (Drop: icon + prohibit-sign
   overlay; Classic: iOS-style slider, same as the theme toggle).
   No structural rules needed here — the existing .tapp_switch /
   .tapp_switch_slider rules in each theme cover the visual layer. */

/* Body-level scoping hooks for prefs. Themes can layer further. */
body.tapp-no-animations *,
body.tapp-no-animations *::before,
body.tapp-no-animations *::after {
    /* Disable CSS transitions/animations when the user has opted out
       of motion. transition-property is forced (not zeroed-duration)
       so no in-flight transition completes. */
    transition: none !important;
    animation: none !important;
}
