/* Design tokens shared by every Flask-templated page (base.html + its
   {% block head %} overrides) - two palettes, switched by setting
   data-theme="light" on <html> (absence of the attribute = dark, the
   default). See /static/js/theme.js for the toggle button wiring and
   base.html for the inline FOUC-prevention script that applies a
   returning visitor's saved choice before first paint.

   --overlay-rgb is the one trick that makes most of the dark-themed
   pages (player/unit/guild_info/index) reusable as-is: they were all
   built out of rgba(255,255,255, X) "white wash on a near-black page"
   utility overlays for tile backgrounds, borders and muted text.
   Swapping the literal 255,255,255 for var(--overlay-rgb) and flipping
   it to 0,0,0 in light mode turns every one of those into an
   appropriately-subtle "black wash on a near-white page" automatically,
   with no per-rule rewrite needed. */
:root {
    /* Tells the browser which native-UI chrome to draw form controls with
       (a <select>'s own popup option list, scrollbars, etc.) - author
       CSS (--input-bg etc.) only reaches the *closed* box, never that
       popup, so without this it always renders with the browser's
       light-mode default regardless of which palette is active, e.g. a
       white options list on this dark theme. */
    color-scheme: dark;
    --bg-page: #0b0d1a;
    --bg-surface: #12142a;
    --bg-surface-alt: rgba(255, 255, 255, 0.05);
    --bg-nav: #14162b;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.75);
    --text-muted: rgba(255, 255, 255, 0.4);
    --border-color: rgba(255, 255, 255, 0.12);
    --border-color-strong: rgba(255, 255, 255, 0.25);
    --link: #7ab8ff;
    --link-visited: #c9a0ff;
    --link-hover: #ffffff;
    --accent-strong: #ffd700;
    --accent-gradient: linear-gradient(45deg, #ffd700, #ff6b35);
    --success: #7acc7a;
    --success-rgb: 122, 204, 122;
    --error: #ff6b6b;
    --error-rgb: 255, 107, 107;
    --error-strong: #ff9999;
    --table-header-bg: rgba(255, 255, 255, 0.08);
    --table-row-hover: rgba(255, 255, 255, 0.05);
    --modal-backdrop: rgba(0, 0, 0, 0.6);
    --modal-bg: #12142a;
    --input-bg: rgba(255, 255, 255, 0.06);
    --input-border: rgba(255, 255, 255, 0.15);
    /* --button-* is a fixed brand navy CTA (login/account's submit
       buttons) - deliberately the same in both themes, not meant to
       re-theme. --button-secondary-* is for everyday UI buttons (guild
       dashboard's "Select Columns…", "TB Plan", etc.) that need to look
       like plain page chrome instead of a call-to-action, so unlike the
       fixed CTA above, this one IS theme-aware. */
    --button-bg: #1a1a2e;
    --button-bg-hover: #2a2a4e;
    --button-text: #ffffff;
    --button-secondary-bg: #2a2a4e;
    --button-secondary-bg-hover: #3a3a5e;
    --button-secondary-text: #ffffff;
    --button-secondary-border: rgba(255, 255, 255, 0.15);
    --role-leader: #cc99ff;
    --role-officer: #99ccff;
    --role-member: lightgreen;
    --ability-zeta: #b98bff;
    --ability-omicron: #ffb066;
    --unit-gl: #ffd700;
    --ms-secondary: #95aac9;
    --ms-set-rgb: 255, 230, 133;
    --overlay-rgb: 255, 255, 255;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg-page: #f4f4f4;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f7f7f7;
    --text-primary: #222222;
    --text-secondary: #555555;
    --text-muted: #888888;
    --border-color: #dddddd;
    --border-color-strong: #bbbbbb;
    --link: #0645ad;
    --link-visited: #551a8b;
    --link-hover: #0b3d91;
    --accent-strong: #8a6d00;
    --accent-gradient: linear-gradient(45deg, #8a6d00, #c1440e);
    --success: #2a7a2a;
    --success-rgb: 42, 122, 42;
    --error: #c00000;
    --error-rgb: 192, 0, 0;
    --error-strong: #900000;
    --table-header-bg: #e9e9e9;
    --table-row-hover: #f5f5f5;
    --button-secondary-bg: #e9e9e9;
    --button-secondary-bg-hover: #dcdcdc;
    --button-secondary-text: #222222;
    --button-secondary-border: #cccccc;
    --modal-backdrop: rgba(0, 0, 0, 0.4);
    --modal-bg: #fefefe;
    --input-bg: #ffffff;
    --input-border: #cccccc;
    --role-leader: #7a3fd1;
    --role-officer: #1f6fc4;
    --role-member: #2a8f4f;
    --ability-zeta: #7a3fd1;
    --ability-omicron: #a85c00;
    --unit-gl: #bf5a00;
    --ms-secondary: #3f5a7a;
    --ms-set-rgb: 138, 109, 0;
    --overlay-rgb: 0, 0, 0;
}

body { background: var(--bg-page); color: var(--text-primary); }
