/*
  Curador design tokens. Direction: Blue Pencil (see brand.md).

  This file is the one source for design values. The reference pages in
  reference/ use nothing else, and the app imports this same file.

  Two layers:
  1. Primitives: the raw palette and scales. Components never use these.
  2. Semantic roles: what components use. Each colour role carries its light and its
     dark value; the dark theme changes nothing else.

  Lengths are in rem so a reader's text-size setting scales the interface.
  1rem is the browser default, 16px unless the reader changed it.
*/

:root {
  /* ---------- 1. Primitives ---------- */

  --grey-0: #FFFFFF;
  --grey-25: #FBFBFD;
  --grey-50: #F4F5F8;
  --grey-100: #ECEEF3;
  --grey-200: #DDE0E7;
  --grey-300: #C4C9D4;
  --grey-400: #A3A9B8;
  --grey-500: #868C9C;
  --grey-600: #565D6D;
  --grey-700: #3A4150;
  --grey-750: #2B3241;
  --grey-800: #232936;
  --grey-900: #141821;
  --grey-925: #10141B;
  --grey-950: #0D1016;

  --blue-50: #E9EDFF;
  --blue-300: #9DB0FF;
  --blue-400: #7C93FA;
  --blue-500: #3D5EF0;
  --blue-600: #2347E0;
  --blue-700: #1A39C4;
  --blue-950: #18224A;

  --red-50: #FDECEA;
  --red-200: #F4C7C2;
  --red-300: #FF9B8F;
  --red-600: #D03A2B;
  --red-700: #B42318;
  --red-900: #5C211B;
  --red-950: #3A1512;

  --amber-50: #FFF3D1;
  --amber-300: #F5C76B;
  --amber-800: #7A4E00;
  --amber-950: #33250A;

  --green-50: #E2F5EA;
  --green-300: #6FD6A0;
  --green-600: #147A50;
  --green-700: #0B6B41;
  --green-950: #0F2E1F;

  --font-family-sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-family-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* ---------- 2. Semantic roles ---------- */

  /* Every colour role has a light and a dark value, written light-dark(light, dark).
     Which one applies follows color-scheme, set at the end of this file. */

  /* Surfaces */
  --color-ground: light-dark(var(--grey-50), var(--grey-950));            /* the page behind cards */
  --color-surface: light-dark(var(--grey-0), var(--grey-900));            /* cards, inputs, dialogs */
  --color-surface-sunken: light-dark(var(--grey-100), var(--grey-800));   /* quoted text, meter tracks, neutral labels */
  --color-surface-nav: light-dark(var(--grey-25), var(--grey-925));       /* sidebar and compact top bar */
  --color-scrim: light-dark(rgb(20 24 33 / 0.45), rgb(0 0 0 / 0.6));      /* behind a dialog */

  /* Borders */
  --color-border: light-dark(var(--grey-200), var(--grey-750));           /* card edges and row dividers */
  --color-border-strong: light-dark(var(--grey-300), var(--grey-700));    /* emphasis dividers */
  --color-border-control: var(--grey-500);                                /* inputs and outlined buttons: 3:1 on surface in both themes */

  /* Text */
  --color-text: light-dark(var(--grey-900), var(--grey-100));
  --color-text-secondary: light-dark(var(--grey-600), var(--grey-400));
  --color-text-nav: light-dark(var(--grey-700), var(--grey-300));
  --color-text-on-action: var(--grey-0);                                  /* on the action colour and the solid status colours */
  --color-customer-ground: var(--grey-900);                               /* behind a customer's content when no brand colour is set: the same in both themes */

  /* Action: the editing blue */
  --color-action: light-dark(var(--blue-600), var(--blue-500));           /* primary buttons, selection, progress */
  --color-action-hover: light-dark(var(--blue-700), var(--blue-600));
  --color-action-text: light-dark(var(--blue-700), var(--blue-300));      /* links and blue text */
  --color-action-soft: light-dark(var(--blue-50), var(--blue-950));       /* current navigation item, informational labels */
  --color-focus: light-dark(var(--blue-600), var(--blue-400));            /* the focus ring */
  --color-action-fill: light-dark(var(--blue-600), var(--blue-400));      /* meter fills and covered slots: 3:1 on the sunken track in both themes */

  /* Status. Each has a text colour and a soft ground. Always paired with an icon and words. */
  --color-needs-you: light-dark(var(--red-700), var(--red-300));          /* waiting for the owner, and nothing else */
  --color-needs-you-soft: light-dark(var(--red-50), var(--red-950));
  --color-needs-you-border: light-dark(var(--red-200), var(--red-900));
  --color-needs-you-solid: light-dark(var(--red-700), var(--red-600));    /* a filled count badge, under text-on-action */
  --color-waiting: light-dark(var(--amber-800), var(--amber-300));        /* borderline, partly delivered, on hold */
  --color-waiting-soft: light-dark(var(--amber-50), var(--amber-950));
  --color-done: light-dark(var(--green-700), var(--green-300));           /* accepted, active, published */
  --color-done-soft: light-dark(var(--green-50), var(--green-950));
  --color-done-solid: light-dark(var(--green-700), var(--green-600));     /* a filled check mark, under text-on-action */
  --color-info: light-dark(var(--blue-700), var(--blue-300));             /* scheduled, informational */
  --color-info-soft: light-dark(var(--blue-50), var(--blue-950));
  --color-neutral: light-dark(var(--grey-600), var(--grey-400));          /* rejected, discarded, setting up */
  --color-neutral-soft: light-dark(var(--grey-100), var(--grey-800));

  /* Type */
  --font-ui: var(--font-family-sans);
  --font-time: var(--font-family-mono);      /* times in schedules and lists */

  --text-small: 0.78125rem;                  /* 12.5px: labels, supporting text */
  --text-section: 0.8125rem;                 /* 13px: section headings */
  --text-body: 0.875rem;                     /* 14px */
  --text-reading: 1rem;                      /* 16px: article text in a package */
  --text-subtitle: 1rem;                     /* 16px: a dialog's title, a plan's name, a package card's headline */
  --text-title: 1.375rem;                    /* 22px: page titles */
  --text-headline: 1.75rem;                  /* 28px: an article's headline, a pricing figure */
  --text-figure: 2.125rem;                   /* 34px: a single large count */
  --text-lead: 1.25rem;                      /* 20px: the paragraph under a public page's headline at wide widths */
  --text-lead-compact: 1.125rem;             /* 18px: the same paragraph at compact widths */
  --text-display: 3.5rem;                    /* 56px: a public page's headline at wide widths */
  --text-display-compact: 2rem;              /* 32px: the same headline at compact widths */

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-strong: 600;

  --leading-figure: 1;                       /* a single large number */
  --leading-display: 1.08;                   /* a public page's headline */
  --leading-tight: 1.15;
  --leading-heading: 1.3;                    /* section headings and labels */
  --leading-body: 1.5;
  --leading-reading: 1.6;
  --tracking-title: -0.02em;
  --tracking-figure: -0.03em;                /* large figures */
  --tracking-display: -0.035em;              /* a public page's headline */
  --tracking-caps: 0.06em;                   /* short labels set in capitals */

  /* Space: a 4px step */
  --space-half: 0.125rem;                    /* 2px: optical alignment only */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;                          /* between the sections of a public page */
  --space-20: 5rem;

  --space-row: 0.6875rem;                    /* 11px above and below a list row */
  --space-card: 0.875rem;                    /* 14px inside a card */
  --space-page: 1.75rem;                     /* 28px around the main column at wide widths */
  --space-page-compact: 1rem;

  /* Shape */
  --radius-small: 0.3125rem;                 /* 5px: chips, quoted blocks */
  --radius-control: 0.5rem;                  /* 8px: buttons, inputs, navigation items */
  --radius-card: 0.625rem;                   /* 10px: cards, dialogs */
  --radius-round: 62.5rem;                   /* status labels, count badges, meters */
  --border-width: 1px;
  --focus-width: 2px;
  --focus-offset: 2px;

  /* Sizes */
  --size-icon: 1.125rem;                     /* 18px */
  --size-icon-control: 1rem;                 /* 16px, inside buttons and beside list text */
  --size-icon-small: 0.875rem;               /* 14px, inside labels */
  --size-mark: 1.375rem;                     /* the logo's height, and its mark's square */
  --size-meter: 0.375rem;                    /* the height of a meter */
  --size-time-column: 3.25rem;                      /* the time column of a timed list */
  --size-control: 2.25rem;                   /* 36px: buttons and inputs at wide widths */
  --size-control-small: 1.875rem;            /* 30px */
  --size-target: 1.5rem;                     /* 24px: the smallest target at wide widths */
  --size-touch: 2.75rem;                     /* 44px: controls at compact widths */
  --size-touch-small: 2.5rem;                /* 40px */
  --size-sidebar: 14.75rem;                  /* 236px */
  --size-aside: 20rem;                       /* the side column on Home and Story */
  --size-reading: 68ch;                      /* longest comfortable line of article text */
  --size-dialog: 30rem;
  --size-media: 30rem;                       /* the widest a package image is shown */
  --size-page: 72rem;                        /* the widest a public page's content runs */
  --size-form: 26rem;                        /* a single-purpose form column */

  /* Layout switches, for reference. Custom properties cannot be used in media
     conditions, so these two numbers are repeated where they are used. Both are
     widths of the viewport: at 67.5rem (1080px) and narrower the side column
     stacks under the main column, and at 53.75rem (860px) and narrower the shell
     becomes compact. */

  /* Motion */
  --motion-fast: 120ms;
  --motion-spin: 0.8s;                       /* one turn of the working spinner */
  --motion-ease: ease-out;
  --motion-arrive: 0.5s;                     /* one part of a public page's picture arriving as the page opens */
  --motion-stagger: 0.3s;                    /* between one part arriving and the next */

  /* Layers. The static reference draws a dialog and a toast in place; the open
     compact menu is the one thing it stacks, on the dialog layer. */
  --layer-dialog: 100;
  --layer-toast: 200;

  /* Theme. color-scheme picks the value of each colour role: by default the system
     setting. data-theme on the root element, or on any part of a page, pins one.
     When each applies is a rule, in rules.md.
     light-dark() needs Chrome 123, Firefox 120 or Safari 17.5. An older browser
     shows none of the colour roles. */
  color-scheme: light dark;
}

[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 0ms;
  }
}
