/* Gaoshi's theme: the only place where colours are defined (design doc §6.3,
   LES-376). Everything else, the base stylesheet and the components of
   Gaoshi_ui, uses these variables; scripts/check-colours.py fails the build on
   a colour literal anywhere else, or on a variable used but not defined.

   Palette B, "navy and paper", chosen by Clem on 2026-11-20 as a provisional
   palette (the final one: LES-567). Every text colour reaches at least 4.5:1
   on --color-bg and --color-surface (WCAG AA); --color-border-strong, which
   outlines form controls, reaches 3:1.

   The theme editor of the component gallery (/dev/gallery, LES-567) reads
   this file and exports it with new values: keep each section under a
   one-line comment, its heading in the editor.

   Light only for the MVP. A dark theme would redefine the colour variables
   only, for example under :root[data-theme="dark"]; the shades follow, since
   they are mixed toward --color-surface. color-mix() needs Firefox 113,
   Chrome 111 or Safari 16.2 (2023). */

:root {
  /* Colours: grounds */
  --color-bg: #F4EFE3;
  --color-surface: #FDFBF5;
  --color-surface-sunken: #EAE5DB;
  --color-row-hover: #F0E8DB;
  --color-overlay: rgb(29 36 51 / 45%);

  /* Colours: text */
  --color-text: #2B2118;
  --color-muted: #6E5E44;
  --color-on-primary: #FFF9EC;

  /* Colours: accent and meaning */
  --color-primary: #7B5224;
  --color-primary-hover: #60401C;
  --color-positive: #327654;
  --color-negative: #892936;
  --color-negative-hover: #6A202A;
  --color-warning: #7A6C1D;

  /* Colours: message backgrounds */
  --color-info-bg: #E6EAEB;
  --color-positive-bg: #E7EEE4;
  --color-warning-bg: #F7F0D9;
  --color-negative-bg: #F1E6E2;

  /* Colours: lines and focus */
  --color-border: #D8D2C7;
  --color-border-strong: #8A7F6A;
  --color-focus: #1a5fb4;
  --shadow-dialog: 0 12px 32px rgb(29 36 51 / 20%);

  /* Chart palette */
  /* 8 colours for chart series (LES-376, with Clem on 2026-11-20), in the
     order charts use them, numbered rather than named since they will
     change. They are far apart from each other (also for red-green colour
     blindness) and from the semantic colours: no green, red or amber series,
     so a series never reads as a gain or a loss. Each reaches 3:1 against
     --color-bg, as chart marks must (WCAG 1.4.11). The last one, a neutral,
     is the colour of "Other". The theme editor checks all of this. */
  --chart-1: #7B5224;
  --chart-2: #57B0A5;
  --chart-3: #305B82;
  --chart-4: #B4596D;
  --chart-5: #A39434;
  --chart-6: #7A75C8;
  --chart-7: #6C3A5E;
  --chart-8: #9FB6C6;

  /* Shades, computed */
  /* Four lighter shades of each chart colour and of the primary, computed
     by the browser (perceptually even steps toward the surface colour), so they
     follow their base colour. For areas next to their base colour, such as
     the securities of an asset class; too light for thin lines or text. */
  --color-primary-tint-1: color-mix(in oklch, var(--color-primary) 80%, var(--color-surface));
  --color-primary-tint-2: color-mix(in oklch, var(--color-primary) 60%, var(--color-surface));
  --color-primary-tint-3: color-mix(in oklch, var(--color-primary) 40%, var(--color-surface));
  --color-primary-tint-4: color-mix(in oklch, var(--color-primary) 20%, var(--color-surface));
  --chart-1-tint-1: color-mix(in oklch, var(--chart-1) 80%, var(--color-surface));
  --chart-1-tint-2: color-mix(in oklch, var(--chart-1) 60%, var(--color-surface));
  --chart-1-tint-3: color-mix(in oklch, var(--chart-1) 40%, var(--color-surface));
  --chart-1-tint-4: color-mix(in oklch, var(--chart-1) 20%, var(--color-surface));
  --chart-2-tint-1: color-mix(in oklch, var(--chart-2) 80%, var(--color-surface));
  --chart-2-tint-2: color-mix(in oklch, var(--chart-2) 60%, var(--color-surface));
  --chart-2-tint-3: color-mix(in oklch, var(--chart-2) 40%, var(--color-surface));
  --chart-2-tint-4: color-mix(in oklch, var(--chart-2) 20%, var(--color-surface));
  --chart-3-tint-1: color-mix(in oklch, var(--chart-3) 80%, var(--color-surface));
  --chart-3-tint-2: color-mix(in oklch, var(--chart-3) 60%, var(--color-surface));
  --chart-3-tint-3: color-mix(in oklch, var(--chart-3) 40%, var(--color-surface));
  --chart-3-tint-4: color-mix(in oklch, var(--chart-3) 20%, var(--color-surface));
  --chart-4-tint-1: color-mix(in oklch, var(--chart-4) 80%, var(--color-surface));
  --chart-4-tint-2: color-mix(in oklch, var(--chart-4) 60%, var(--color-surface));
  --chart-4-tint-3: color-mix(in oklch, var(--chart-4) 40%, var(--color-surface));
  --chart-4-tint-4: color-mix(in oklch, var(--chart-4) 20%, var(--color-surface));
  --chart-5-tint-1: color-mix(in oklch, var(--chart-5) 80%, var(--color-surface));
  --chart-5-tint-2: color-mix(in oklch, var(--chart-5) 60%, var(--color-surface));
  --chart-5-tint-3: color-mix(in oklch, var(--chart-5) 40%, var(--color-surface));
  --chart-5-tint-4: color-mix(in oklch, var(--chart-5) 20%, var(--color-surface));
  --chart-6-tint-1: color-mix(in oklch, var(--chart-6) 80%, var(--color-surface));
  --chart-6-tint-2: color-mix(in oklch, var(--chart-6) 60%, var(--color-surface));
  --chart-6-tint-3: color-mix(in oklch, var(--chart-6) 40%, var(--color-surface));
  --chart-6-tint-4: color-mix(in oklch, var(--chart-6) 20%, var(--color-surface));
  --chart-7-tint-1: color-mix(in oklch, var(--chart-7) 80%, var(--color-surface));
  --chart-7-tint-2: color-mix(in oklch, var(--chart-7) 60%, var(--color-surface));
  --chart-7-tint-3: color-mix(in oklch, var(--chart-7) 40%, var(--color-surface));
  --chart-7-tint-4: color-mix(in oklch, var(--chart-7) 20%, var(--color-surface));
  --chart-8-tint-1: color-mix(in oklch, var(--chart-8) 80%, var(--color-surface));
  --chart-8-tint-2: color-mix(in oklch, var(--chart-8) 60%, var(--color-surface));
  --chart-8-tint-3: color-mix(in oklch, var(--chart-8) 40%, var(--color-surface));
  --chart-8-tint-4: color-mix(in oklch, var(--chart-8) 20%, var(--color-surface));

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  /* Typography: system fonts, nothing downloaded */
  --font-text: "Times New Roman", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-size-sm: 0.8125rem;
  --font-size-md: 0.9375rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.5rem;
  --font-size-xxl: 2rem;
  --font-weight-normal: 400;
  --font-weight-bold: 600;
  --line-height: 1.5;
  --line-height-tight: 1.25;

  /* Shapes */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --border-width: 1px;
  --focus-ring: 2px solid var(--color-focus);
  --focus-offset: 2px;

  /* Layout */
  --content-width: 72rem;
  --control-height: 2.25rem;
}
/* Base styles for every page, after the theme (static/dune concatenates
   theme.css and this file into gaoshi.css). Only theme variables: components
   style themselves with ppx_css in Gaoshi_ui. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-text);
  font-size: 100%;
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-size: var(--font-size-md);
}

h1,
h2,
h3 {
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}

h1 {
  font-size: var(--font-size-xl);
}

h2 {
  font-size: var(--font-size-lg);
}

h3 {
  font-size: var(--font-size-md);
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--color-primary);
}

a:hover {
  color: var(--color-primary-hover);
}

/* Keyboard focus is always visible; mouse clicks don't draw it. */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
