/*
  The site's colours, by role, defined once here (the design guide's "theme
  tokens"). Everything else uses these roles, never a literal colour, so a
  theme is just this file's values. Lizzard's identity is green, as a lizard
  should be; the guide's own palette was a starting point, not a rule
  (the project owner, 2026-11-07).

  Themes: Light (the default), Dark and Blue Dark, set on <html data-theme>
  by the server from the visitor's choice, or by theme.js for "System".
*/

/* Light: pale surfaces, fine borders, deep green for actions and headings. */
:root {
    --page: #f3f6f3;
    --surface: #ffffff;
    --surface-2: #f6f9f6;
    --text: #1d2a22;
    --text-2: #56665b;
    --border: #dfe7e0;
    --control-border: #76857a;   /* a field's edge: 3:1 against page and surfaces */
    --accent: #23794a;          /* links and actions */
    --accent-strong: #1b6a3f;   /* hover */
    --on-accent: #ffffff;       /* text on an accent background */
    --accent-soft: #e2f1e7;     /* chosen item backgrounds, tags */
    --heading: #1f5f3b;         /* page titles */
    --heading-section: #2a6a6a; /* section titles */
    --eyebrow: #806220;         /* small context headings (4.9:1 even on --accent-soft, measured 2026-11-07) */
    --focus: #1f5fbf;
    --shadow: 0 1px 2px rgba(20, 40, 25, 0.06);
    --info-bg: #e8f0fb;   --info-line: #5b84c4;
    --success-bg: #e3f3e8; --success-line: #3f9a63;
    --warning-bg: #fbf1dc; --warning-line: #c99a2e;
    --error-bg: #fbe5e3;   --error-line: #c4534a;
    color-scheme: light;
}

/* Dark: near-black surfaces told apart by tone and borders, lizard greens for accents. */
:root[data-theme="dark"] {
    --page: #141715;
    --surface: #1c201d;
    --surface-2: #232825;
    --text: #e6e9e5;
    --text-2: #a6aea8;
    --border: #343b36;
    --control-border: #76827a;   /* a field's edge: 3:1 against page and surfaces */
    --accent: #6cc28d;
    --accent-strong: #8fd6a9;
    --on-accent: #0e1a12;
    --accent-soft: #23352a;
    --heading: #8fd6a9;
    --heading-section: #7cc9b9;
    --eyebrow: #d6b56f;
    --focus: #8ab4ff;
    --shadow: none;
    --info-bg: #1d2a3a;   --info-line: #6f97d6;
    --success-bg: #1d3125; --success-line: #5fb57f;
    --warning-bg: #3a3020; --warning-line: #c99a3e;
    --error-bg: #3a2120;   --error-line: #d4736a;
    color-scheme: dark;
}

/* Blue Dark: deep blue surfaces, with green-teal accents to keep the identity. */
:root[data-theme="blue-dark"] {
    --page: #101a28;
    --surface: #192637;
    --surface-2: #1d2d42;
    --text: #e5ecf5;
    --text-2: #a4b3c8;
    --border: #304157;
    --control-border: #7388a3;   /* a field's edge: 3:1 against page and surfaces */
    --accent: #7fd1b0;
    --accent-strong: #a3e3c8;
    --on-accent: #0c1a24;
    --accent-soft: #1f3a44;
    --heading: #9fdcc2;
    --heading-section: #80c9c2;
    --eyebrow: #d8b774;
    --focus: #9ab4ff;
    --shadow: none;
    --info-bg: #1b2c45;   --info-line: #7c9ee0;
    --success-bg: #1a3433; --success-line: #63b99a;
    --warning-bg: #36301f; --warning-line: #c9a24a;
    --error-bg: #3a2229;   --error-line: #d97a7f;
    color-scheme: dark;
}

/*
  "System" with scripts off: theme.js isn't there to choose, so the device's
  dark setting picks Dark here. These are the Dark values again; keep the two
  blocks the same (a selector can't be shared between an attribute rule and a
  media query).
*/
@media (prefers-color-scheme: dark) {
    :root[data-theme-choice="system"]:not([data-theme]) {
        --page: #141715;
        --surface: #1c201d;
        --surface-2: #232825;
        --text: #e6e9e5;
        --text-2: #a6aea8;
        --border: #343b36;
        --control-border: #76827a;   /* a field's edge: 3:1 against page and surfaces */
        --accent: #6cc28d;
        --accent-strong: #8fd6a9;
        --on-accent: #0e1a12;
        --accent-soft: #23352a;
        --heading: #8fd6a9;
        --heading-section: #7cc9b9;
        --eyebrow: #d6b56f;
        --focus: #8ab4ff;
        --shadow: none;
        --info-bg: #1d2a3a;   --info-line: #6f97d6;
        --success-bg: #1d3125; --success-line: #5fb57f;
        --warning-bg: #3a3020; --warning-line: #c99a3e;
        --error-bg: #3a2120;   --error-line: #d4736a;
        color-scheme: dark;
    }
}

/*
  Bootstrap's own colour variables, set from these roles so its parts (buttons,
  form fields, tables, cards) follow the chosen theme, as on the other journal
  sites. Bootstrap's file is loaded before this one.
*/
:root, :root[data-theme] {
    --bs-body-bg: var(--page);
    --bs-body-color: var(--text);
    --bs-emphasis-color: var(--text);
    --bs-border-color: var(--border);
    --bs-secondary-color: var(--text-2);
    --bs-secondary-bg: var(--surface-2);
    --bs-tertiary-bg: var(--surface-2);
    --bs-link-color: var(--accent);
    --bs-link-hover-color: var(--accent-strong);
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
