/* ==================================================================
   Light theme. Shared by every page in web/style-guide/.

   Only semantic tokens change; primitives and components stay the same.
   js/theme.js sets <html data-theme="light|dark"> before first paint:
   the stored choice wins, otherwise prefers-color-scheme decides.

   Contrast targets (checked live in the style guide Color section):
   text 4.5:1 on its surface, focus and state indicators 3:1.
   ================================================================== */
:root[data-theme="light"] {
  color-scheme: light;

  /* Surfaces: wells are darker than panels, raised is a light gray step */
  --surface-canvas: #F5F6F8;
  --surface-chrome: #FFFFFF;
  --surface-panel: #FFFFFF;
  --surface-raised: #F3F4F7;
  --surface-inset: #EFF1F4;
  --surface-hover: #ECEEF2;
  --surface-selected: #E4E7EE;
  --surface-overlay: rgb(15 17 22 / 0.40);

  /* Text */
  --text-strong: #0B0C0F;
  --text-primary: #1A1D23;
  --text-secondary: #3A3F49;
  --text-muted: #5B616C;
  --text-disabled: #8A909A;
  --text-link: #3F55B0;
  --text-code: #2A2E36;

  /* Borders and focus */
  --border-subtle: #E6E8EC;
  --border-default: #D8DBE1;
  --border-strong: #B4B9C3;
  --border-error: #C23B3B;
  --border-selection: #5064BE;
  --focus-color: #5064BE;

  /* Brand and action (same desaturated hue as dark, darker for white text) */
  --accent: #5064BE;
  --accent-soft: rgb(80 100 190 / 0.10);
  --accent-line: rgb(80 100 190 / 0.30);
  --on-accent: #FFFFFF;
  --action-primary: #4E62BC;
  --action-primary-hover: #4758AE;
  --action-primary-pressed: #3F4F9E;
  --action-danger-soft: rgb(194 59 59 / 0.06);

  /* Feedback */
  --info: #3F55B0;     --info-bg: rgb(63 85 176 / 0.07);    --info-line: rgb(63 85 176 / 0.28);
  --success: #1D7549;  --success-bg: rgb(29 117 73 / 0.07); --success-line: rgb(29 117 73 / 0.28);
  --warning: #855600;  --warning-bg: rgb(176 118 0 / 0.08); --warning-line: rgb(176 118 0 / 0.32);
  --danger: #BB3434;   --danger-bg: rgb(187 52 52 / 0.06);  --danger-line: rgb(187 52 52 / 0.28);

  /* Status states */
  --state-queued: #5B616C;
  --state-active: #08718E;
  --state-review: #855600;
  --state-blocked: #A83232;
  --state-paused: #6547BD;
  --state-done: #1D7549;
  --state-failed: #BB3434;
  --state-cancelled: #646A75;
  --state-unknown: #646A75;

  /* Syntax on --surface-inset */
  --syn-plain: #2A2E36;
  --syn-keyword: #6E3FBF;
  --syn-function: #3450A8;
  --syn-string: #1D7549;
  --syn-number: #855600;
  --syn-type: #08708C;
  --syn-comment: #626873;
  --syn-punct: #555B66;
  --syn-gutter: #7C828D;
  --syn-active-line: rgb(0 0 0 / 0.04);
  --syn-selection: rgb(80 100 190 / 0.18);
  --syn-match: rgb(176 118 0 / 0.22);

  /* Chart highlights */
  --hl-evidence: rgb(176 118 0 / 0.20);
  --hl-evidence-line: #855600;
  --hl-selected: rgb(80 100 190 / 0.20);

  /* Elevation: softer shadows on light surfaces */
  --shadow-1: 0 1px 0 rgb(16 24 40 / 0.06);
  --shadow-2: 0 8px 24px rgb(16 24 40 / 0.10);
  --shadow-3: 0 16px 40px rgb(16 24 40 / 0.14);
}

/* Theme toggle button (header). Shows the theme you would switch to. */
.theme-toggle {
  position: relative;
  width: 40px; height: 40px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; background: transparent; cursor: pointer;
  border: 1px solid var(--border-default); border-radius: 10px;
  color: var(--text-secondary);
}
.theme-toggle:hover { border-color: var(--border-strong); color: var(--text-strong); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="light"] .theme-toggle .when-dark,
:root:not([data-theme="light"]) .theme-toggle .when-light { display: none; }
