/* Aisle — the warehouse design system. Tokens.
   Applies under the looks "aisle" (light) and "aisle-night" (dark), picked with the Style switch (js/looks-ds.js).
   Primitives first, then the ROLES every component asks for (type, weight, space, radius, height, motion, altitude),
   then the semantic colours, then the variables of styles.css mapped onto them, so every existing rule picks the
   system up without being rewritten. The language these serve is written down in ds/DESIGN.md; the components that
   use them are ds/kit.css, and the card menu is ds/menu.css.

   Principles (ds/DESIGN.md says each one at length)
   1. Codes are labels. Location and pallet codes are set like the printed rack label: condensed, heavy, ink.
   2. Colour means state, never decoration. Beam orange = the thing you picked, safety yellow = waiting,
      green = free or stored, red = a broken rule, cobalt = on the road. Everything else is zinc and ink.
   3. A choice is a wash of ink. The view you are on, the tab, the segment, the setting that is on: 7% ink, no lift.
   4. Instruments on glass. Panels over the 3D twin are frosted, hairline-edged and compact; pages are white cards
      on concrete, and the menu is one more card.
   5. Quiet chrome, loud data. Labels small, sentence case, zinc; numbers large and condensed.
   6. Radius follows size: 4 marks, 8 controls and rows, 12 cards and panels, 16 dialogs. Pills only for counts,
      states and settings. */

@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(../fonts/ds/archivo-latin-wdth-normal.woff2) format("woff2-variations"), url(../fonts/ds/archivo-latin-wdth-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(../fonts/ds/archivo-latin-ext-wdth-normal.woff2) format("woff2-variations"), url(../fonts/ds/archivo-latin-ext-wdth-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* The same Archivo fixed at the code width, so any rule that asks for var(--narrow) gets condensed type without
   having to set font-stretch itself. */
@font-face {
  font-family: "Aisle Code"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 74%;
  src: url(../fonts/ds/archivo-latin-wdth-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Aisle Code"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 74%;
  src: url(../fonts/ds/archivo-latin-ext-wdth-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* And at the heading width, for titles. */
@font-face {
  font-family: "Aisle Head"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 88%;
  src: url(../fonts/ds/archivo-latin-wdth-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Aisle Head"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 88%;
  src: url(../fonts/ds/archivo-latin-ext-wdth-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root[data-look^="aisle"] {
  /* ---- primitives ------------------------------------------------------------------------------------------ */

  /* Zinc: galvanised steel, a faint blue-green cast. */
  --zinc-0: #ffffff;
  --zinc-25: #fafbfb;
  --zinc-50: #f4f6f6;
  --zinc-100: #eceff0;
  --zinc-150: #e3e7e8;
  --zinc-200: #d5dadc;
  --zinc-300: #bac1c4;
  --zinc-400: #939ca0;
  --zinc-500: #6b757a;
  --zinc-600: #525b60;
  --zinc-700: #3a4246;
  --zinc-800: #262b2e;
  --zinc-850: #1d2124;
  --zinc-900: #171a1c;
  --zinc-950: #0f1213;

  /* Beam: the pallet-rack beam. The brand colour; marks where you are and what is selected. */
  --beam-50: #fff3ed;
  --beam-100: #ffe3d4;
  --beam-200: #ffc4a6;
  --beam-300: #fd9c6e;
  --beam-400: #f47640;
  --beam-500: #e2561d;
  --beam-600: #c44513;
  --beam-700: #9c3712;

  /* Safety: floor-marking yellow. Waiting, at the dock, needs a person. */
  --safety-50: #fff9e0;
  --safety-100: #fff0b3;
  --safety-300: #ffd84a;
  --safety-400: #f7c600;
  --safety-500: #e0b000;
  --safety-700: #7a5d00;

  /* Go: free positions, stored, delivered. */
  --go-50: #ebf8f0;
  --go-100: #cdeedb;
  --go-300: #6fcb97;
  --go-500: #16a05a;
  --go-600: #0f8549;
  --go-700: #0c6b3b;

  /* Stop: a broken rule, expired, failed. */
  --stop-50: #fdeeec;
  --stop-100: #fad4cf;
  --stop-300: #f08a7d;
  --stop-500: #d92d20;
  --stop-600: #b8231a;
  --stop-700: #921d16;

  /* Cobalt: on the road, information, links. */
  --cobalt-50: #eef3fe;
  --cobalt-100: #d8e4fd;
  --cobalt-300: #86a8f5;
  --cobalt-500: #2d63e0;
  --cobalt-600: #224fc0;
  --cobalt-700: #1c3f96;

  /* ---- type ------------------------------------------------------------------------------------------------ */

  --font-sans: "Archivo", "Barlow", system-ui, sans-serif;
  --font-code: "Aisle Code", "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-head: "Aisle Head", "Archivo", "Barlow", system-ui, sans-serif;
  --font-label: "Barlow Condensed", "Archivo", "Arial Narrow", sans-serif; /* only the printed-label replica */
  --stretch-code: 74%;      /* codes, big numbers */
  --stretch-head: 88%;      /* headings */
  /* The raw scale. Components do not read it: they read the roles below. */
  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 26px;
  --text-3xl: 30px;
  --text-4xl: 46px;
  --leading: 1.5;
  --leading-snug: 1.35;
  --leading-tight: 1.15;
  --track-head: -0.012em;
  --track-code: 0.01em;

  /* THE ROLES. Every size on a page is one of these; anything that fits none of them is the wrong size.
     Words are Archivo, headings Archivo at the heading width, codes and figures Archivo at the code width. */
  --ty-page: var(--text-3xl);       /* what the page is called, once, at its top            (head 650) */
  --ty-title: var(--text-xl);       /* what a dialog or an opened record is called          (head 650) */
  --ty-head: var(--text-lg);        /* what a card or a panel is called                     (head 650) */
  --ty-body: var(--text-md);        /* a line of text, a cell, a field, a menu row          (sans 400) */
  --ty-ui: var(--text-sm);          /* a button, a tab, a segment, a field's label          (sans 500–600) */
  --ty-note: var(--text-xs);        /* what qualifies: a note, a time, a column head        (sans 400–500) */
  --ty-micro: var(--text-2xs);      /* a count in a badge, a unit, a key cap. THE FLOOR     (sans 600) */
  --ty-code: 16px;                  /* a code in a row or a list                            (code 700) */
  --ty-code-title: 22px;            /* a code that names a card in a list, or what is open (code 700) */
  --ty-fig: var(--text-3xl);        /* a figure in a tile                                   (code 700) */
  --ty-hero: 36px;                  /* the one figure a panel is about                      (code 700) */

  /* Weights by name, never by number. */
  --wt-regular: 400;
  --wt-mid: 500;
  --wt-strong: 600;
  --wt-head: 650;
  --wt-code: 700;

  /* ---- space, size, radius --------------------------------------------------------------------------------- */

  /* A 4px grid, with the 2 and 6 the product already keeps for tight inner gaps. */
  --space-half: 2px;
  --space-1: 4px;
  --space-1h: 6px;
  --space-2: 8px;
  --space-2h: 10px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  /* Heights: one control is 32 high, a small one 28, a row in a menu or a list 36, a large confirm 40. */
  --control-sm: 28px;
  --control-md: 32px;
  --control-lg: 40px;
  --row: 36px;
  --radius-xs: 4px;   /* marks: key caps, swatches, small badges */
  --radius-sm: 8px;   /* controls, menu rows, list rows */
  --radius-md: 12px;  /* cards, panels, popovers, toasts, the menu card */
  --radius-lg: 16px;  /* dialogs */
  --radius-pill: 999px;

  /* ---- the card menu ---------------------------------------------------------------------------------------- */

  --menu-card: 252px;   /* the card's own width */
  --menu-rail: 56px;    /* the card folded to its marks */
  --menu-gutter: 8px;   /* the concrete around it */
  --menu-w: 0px;        /* what the menu takes from the left edge: set by ds/menu.css while the card is worn */

  /* ---- motion ---------------------------------------------------------------------------------------------- */

  /* Three speeds and one pause. Colour answers a pointer at --dur-fast; a fold, a toggle, a selection moves at
     --dur; a surface arrives at --dur-slow. A hover waits --dur-peek before it shows anything. */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);        /* arriving, answering */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);         /* leaving */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1); /* moving from one place to another */
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 320ms;
  --dur-peek: 300ms;
  --dur-spin: 800ms;  /* one turn of the loading ring */

  /* ---- altitude: what stands over what -------------------------------------------------------------------- */

  /* The scene is the floor. A shadow is a height (--e-*) and this is the stack that goes with it. Native dialogs
     open in the top layer and need none. */
  --z-panel: 2;     /* panels over the scene */
  --z-page: 3;      /* a page over the scene */
  --z-menu: 4;      /* the menu over pages and panels */
  --z-tip: 5;       /* a tooltip over everything it explains */
  --z-pop: 6;       /* a popover, a dropdown, a toast */

  /* ---- semantic: light ------------------------------------------------------------------------------------- */

  --bg-canvas: #e7eaeb;                 /* concrete behind pages */
  --bg-sheet: var(--zinc-0);            /* cards, panels */
  --bg-raised: var(--zinc-0);           /* popovers, menus */
  --bg-sunken: var(--zinc-50);          /* wells, table heads, inputs at rest */
  --bg-hover: rgba(23, 26, 28, 0.045);
  --bg-press: rgba(23, 26, 28, 0.08);
  --bg-selected: var(--beam-50);
  --bg-ink: var(--zinc-900);            /* primary buttons, tooltips, toasts */
  --bg-ink-hover: var(--zinc-700);
  /* THE WASHES. Everything pressable that has no fill of its own answers a pointer with --wash-hover, and a
     choice that is made (the view you are on, the tab, the segment, the setting that is on) wears --wash-on. */
  --wash-hover: rgba(23, 26, 28, 0.04);
  --wash-on: rgba(23, 26, 28, 0.07);
  --wash-press: rgba(23, 26, 28, 0.1);
  /* THE PICK. The object you picked in the data (a pallet, a location, a delivery, a row) wears beam orange:
     a ring on a card, a bar on a row. Never a choice of view, never a filter. */
  --picked-bg: var(--accent-soft);
  --picked-line: var(--accent);

  --fg-1: var(--zinc-900);
  --fg-2: var(--zinc-600);
  --fg-3: var(--zinc-500);
  --fg-disabled: var(--zinc-400);
  --fg-on-ink: var(--zinc-0);
  --fg-on-accent: var(--zinc-0);
  --fg-on-wait: var(--zinc-950);      /* text on safety yellow: a count, Undo */
  --knob: var(--zinc-0);              /* the knob of a switch */

  --line-1: rgba(23, 26, 28, 0.09);     /* hairlines */
  --line-2: rgba(23, 26, 28, 0.16);     /* control borders */
  --line-3: rgba(23, 26, 28, 0.32);     /* hovered controls */
  --control-off: var(--zinc-300);       /* a switch that is off */
  --line-control: rgba(23, 26, 28, 0.48); /* input edges: 3:1 on the sheet, so a field is visible as a field */
  --line-ink: var(--zinc-900);

  --accent: var(--beam-500);
  --accent-hover: var(--beam-600);
  --accent-soft: var(--beam-50);
  --accent-line: var(--beam-200);
  --accent-fg: var(--beam-700);

  --ok: var(--go-500);
  --ok-strong: var(--go-600);
  --ok-soft: var(--go-50);
  --ok-line: var(--go-100);
  --ok-fg: var(--go-700);
  --ok-button: var(--go-600);           /* green buttons: white text stays readable in both themes */
  --ok-button-hover: var(--go-700);
  --wait: var(--safety-400);
  --wait-soft: var(--safety-50);
  --wait-line: #f2dc8a;
  --wait-fg: var(--safety-700);
  --wait-hover: var(--safety-300);
  --bad: var(--stop-500);
  --bad-strong: var(--stop-600);
  --bad-soft: var(--stop-50);
  --bad-line: var(--stop-100);
  --bad-fg: var(--stop-700);
  --info: var(--cobalt-500);
  --info-soft: var(--cobalt-50);
  --info-line: var(--cobalt-100);
  --info-fg: var(--cobalt-700);

  --glass-bg: rgba(250, 251, 251, 0.82);
  --glass-line: rgba(255, 255, 255, 0.7);
  --glass-edge: rgba(23, 26, 28, 0.08);
  --glass-blur: saturate(1.6) blur(18px);

  /* ONE focus object, for the keyboard only (:focus-visible): a hairline of paper, then beam. */
  --focus: 0 0 0 2px var(--bg-sheet), 0 0 0 4px rgba(226, 86, 29, 0.55);
  /* A SHADOW IS A HEIGHT, and there are four: a card resting on the concrete, a card floating over it (the menu,
     the panels over the scene), what pops over a card (a dropdown, a toast, the inspector), and a dialog. */
  --e-1: 0 1px 1px rgba(15, 18, 19, 0.04), 0 1px 3px rgba(15, 18, 19, 0.06);
  --e-2: 0 1px 2px rgba(15, 18, 19, 0.05), 0 8px 24px -6px rgba(15, 18, 19, 0.14);
  --e-3: 0 2px 6px rgba(15, 18, 19, 0.06), 0 24px 56px -12px rgba(15, 18, 19, 0.28);
  --e-4: 0 4px 12px rgba(15, 18, 19, 0.08), 0 40px 80px -24px rgba(15, 18, 19, 0.4);
  --shadow-1: var(--e-1);
  --shadow-2: var(--e-2);
  --shadow-3: var(--e-3);
  --scrim: rgba(15, 18, 19, 0.42);

  /* ---- the variables of styles.css (and the stylesheets built on it), mapped onto the tokens ---------------- */

  --ink: var(--fg-1);
  --ink-soft: var(--fg-2);
  --label: var(--bg-sheet);
  --concrete: var(--bg-canvas);
  --glass: var(--glass-bg);
  --rule: var(--line-2);
  --steel: var(--zinc-400);
  --beam: var(--accent);
  --safety: var(--wait);
  --free: var(--ok);
  --danger: var(--bad);
  --field: var(--bg-sheet);
  --sans: var(--font-sans);
  --narrow: var(--font-code);
  --gap: 14px;
  --top: 56px;

  color-scheme: light;
}

/* ---- semantic: night ----------------------------------------------------------------------------------------- */

:root[data-look="aisle-night"] {
  --bg-canvas: #0d0f10;
  --bg-sheet: #16191b;
  --bg-raised: #1d2124;
  --bg-sunken: #111415;
  --bg-hover: rgba(236, 239, 240, 0.055);
  --bg-press: rgba(236, 239, 240, 0.1);
  --bg-selected: rgba(226, 86, 29, 0.14);
  --bg-ink: #eceff0;
  --bg-ink-hover: #ffffff;
  --wash-hover: rgba(236, 239, 240, 0.05);
  --wash-on: rgba(236, 239, 240, 0.09);
  --wash-press: rgba(236, 239, 240, 0.13);

  --fg-1: #eceff0;
  --fg-2: #a3acb0;
  --fg-3: #7e878c;
  --fg-disabled: #565e62;
  --fg-on-ink: #111415;
  --fg-on-accent: #ffffff;

  --line-1: rgba(236, 239, 240, 0.08);
  --line-2: rgba(236, 239, 240, 0.14);
  --line-3: rgba(236, 239, 240, 0.3);
  --control-off: #3a4246;
  --line-control: rgba(236, 239, 240, 0.37);
  --line-ink: #eceff0;

  --accent: #f0662c;
  --accent-hover: #f47640;
  --accent-soft: rgba(240, 102, 44, 0.14);
  --accent-line: rgba(240, 102, 44, 0.4);
  --accent-fg: #ffad86;

  --ok: #22b968;
  --ok-strong: #2fcf7a;
  --ok-soft: rgba(34, 185, 104, 0.14);
  --ok-line: rgba(34, 185, 104, 0.34);
  --ok-fg: #6fdc9e;
  --ok-button: #137a43;
  --ok-button-hover: #158a4b;
  --wait: #f7c600;
  --wait-soft: rgba(247, 198, 0, 0.13);
  --wait-line: rgba(247, 198, 0, 0.36);
  --wait-fg: #ffd84a;
  --bad: #f04438;
  --bad-strong: #c7322a;
  --bad-soft: rgba(240, 68, 56, 0.14);
  --bad-line: rgba(240, 68, 56, 0.38);
  --bad-fg: #ff9a91;
  --info: #5b8af0;
  --info-soft: rgba(91, 138, 240, 0.15);
  --info-line: rgba(91, 138, 240, 0.4);
  --info-fg: #a9c2fa;

  --glass-bg: rgba(22, 25, 27, 0.78);
  --glass-line: rgba(255, 255, 255, 0.06);
  --glass-edge: rgba(0, 0, 0, 0.5);
  --glass-blur: saturate(1.3) blur(20px);

  --focus: 0 0 0 2px var(--bg-sheet), 0 0 0 4px rgba(240, 102, 44, 0.7);
  /* At night a height is nearer the light: an inner top edge, then the shadow. */
  --e-1: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 1px 2px rgba(0, 0, 0, 0.4);
  --e-2: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -6px rgba(0, 0, 0, 0.6);
  --e-3: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 2px 6px rgba(0, 0, 0, 0.4), 0 28px 64px -12px rgba(0, 0, 0, 0.75);
  --e-4: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 4px 12px rgba(0, 0, 0, 0.5), 0 44px 90px -24px rgba(0, 0, 0, 0.85);
  --scrim: rgba(0, 0, 0, 0.6);

  --steel: #6b757a;
  color-scheme: dark;
}
