/* Tenrok brand tokens — vendored from github.com/jackykornet/brand
   (css/brandstyle.css + brand-guidelines.md).

   The light values in `:root` are the upstream palette, copied verbatim so
   re-syncing with the brand repo stays mechanical. The brand repo only ships
   a light palette, so the `--dark-*` values below are derived here: same
   hues, re-pitched for a dark ground.

   Do not add colors that are not in the brand repo. Hover/active shades are
   derived from approved tokens and marked as such where they appear.

   Theme resolution:
     no attribute        -> follows the OS via prefers-color-scheme
     data-theme="light"  -> forced light, even on a dark OS
     data-theme="dark"   -> forced dark, even on a light OS */

:root {
  /* Primary — plum */
  --color-primary: #9B5DE5;
  --color-primary-light: #DCC8F5;
  --color-primary-dark: #582C8C;

  /* Accent */
  --color-accent: #FAC775;
  --color-accent-dark: #412402;

  /* Neutrals */
  --color-bg: #FDF8F3;
  --color-surface: #FFFFFF;
  --color-text-primary: #2C2C2A;
  --color-text-secondary: #5F5E5A;
  --color-border: #E4DED6;

  /* Semantic */
  --color-success: #639922;
  --color-warning: #BA7517;
  --color-error: #A32D2D;

  /* Typography */
  --font-heading: 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;

  /* Interactive mapping — serves brand-guidelines.md "keep contrast high for
     accessibility on text and buttons". Base plum #9B5DE5 on white is only
     4.2:1, under the 4.5:1 minimum for text, so in light mode anything
     *bearing* text (buttons, links) uses the approved --color-primary-dark at
     9.8:1, and the base plum is reserved for identity accents that carry no
     text: focus rings, the active nav underline, the logo dot. In dark mode
     the lightened plum clears 7:1, so it serves both roles. */
  --color-action: var(--color-primary-dark);
  --color-action-hover: #4D2779; /* state shade: --color-primary-dark, -12% L */
  --color-on-action: #FFFFFF;

  /* The period in the wordmark. Read by the inlined logo SVGs; follows
     --color-primary, so it re-pitches with the theme automatically. */
  --color-brand-dot: var(--color-primary);

  /* Text-safe semantic colors. The mid-tone success and warning greens/ambers
     only reach ~3:1 as text on their own light tints, so badges and flashes
     use these darkened shades instead. Error is already 6.4:1 and passes as
     is. In dark mode the semantic colors are light enough to use directly. */
  --color-success-text: color-mix(in srgb, var(--color-success) 72%, #000);
  --color-warning-text: color-mix(in srgb, var(--color-warning) 72%, #000);
  --color-error-text: var(--color-error);

  /* Dark-ground values. Held here so every literal is written once; the two
     selectors below only remap, never redeclare a color. Plum lightens so it
     clears 4.5:1 on the dark surface; the neutrals keep the brand's warm
     bias rather than going blue-grey, so both themes read as one system. */
  --dark-primary: #C39BEF;
  --dark-primary-light: #E3D3F8;
  --dark-primary-dark: #9B5DE5;
  --dark-bg: #1A1719;
  --dark-surface: #221E24;
  --dark-text-primary: #F2EDE8;
  --dark-text-secondary: #A9A19F;
  --dark-border: #39323C;
  --dark-success: #8FC44E;
  --dark-warning: #E0A445;
  --dark-error: #E58B84;
  --dark-action-hover: #D4B6F4; /* state shade: --dark-primary, +8% L */
  --dark-on-action: #23142F;    /* deep plum, same hue family */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary: var(--dark-primary);
    --color-primary-light: var(--dark-primary-light);
    --color-primary-dark: var(--dark-primary-dark);
    --color-bg: var(--dark-bg);
    --color-surface: var(--dark-surface);
    --color-text-primary: var(--dark-text-primary);
    --color-text-secondary: var(--dark-text-secondary);
    --color-border: var(--dark-border);
    --color-success: var(--dark-success);
    --color-warning: var(--dark-warning);
    --color-error: var(--dark-error);
    --color-action: var(--dark-primary);
    --color-action-hover: var(--dark-action-hover);
    --color-on-action: var(--dark-on-action);
    --color-success-text: var(--dark-success);
    --color-warning-text: var(--dark-warning);
    --color-error-text: var(--dark-error);
  }
}

:root[data-theme="dark"] {
  --color-primary: var(--dark-primary);
  --color-primary-light: var(--dark-primary-light);
  --color-primary-dark: var(--dark-primary-dark);
  --color-bg: var(--dark-bg);
  --color-surface: var(--dark-surface);
  --color-text-primary: var(--dark-text-primary);
  --color-text-secondary: var(--dark-text-secondary);
  --color-border: var(--dark-border);
  --color-success: var(--dark-success);
  --color-warning: var(--dark-warning);
  --color-error: var(--dark-error);
  --color-action: var(--dark-primary);
  --color-action-hover: var(--dark-action-hover);
  --color-on-action: var(--dark-on-action);
  --color-success-text: var(--dark-success);
  --color-warning-text: var(--dark-warning);
  --color-error-text: var(--dark-error);
}
