/* Ledger A - design tokens: every colour and every piece of type, named once, here.
   Linked first in index.html. The other stylesheets only USE these (var(--...)); a raw colour or
   font value anywhere else is a mistake (T3 will make Stylelint refuse it).

   Three layers:
     1. PALETTE - the raw values, named for what they are (--cream-100, --lilac-400).
     2. ROLES   - the jobs the app needs done (--colour-accent, --colour-text-muted,
                  --font-size-sm). Personalising and themes change THESE and nothing else.
                  Roles point at the palette; the CSS files use only roles.
     3. (Component tokens come later, only where one piece needs its own knob.)

   Look: rough 60 / 30 / 10 -
     60%  cream        - page frame ("proscenium") and the calendar stage
     30%  cream shades - buttons and cards sitting on the frame
     10%  lilac accent - the few things that should pop (+ Add, today) */

:root {
  /* ---------- 1. palette ---------- */
  /* cream, light to dark */
  --cream-50: #fdf6ea;
  --cream-100: #f6e9d7;
  --cream-200: #eedfc8;
  --cream-300: #e3d0b3;
  --cream-line: #eadfcd;
  --cream-line-strong: #d9c9ae;
  --cream-scroll: #d6c2a3;
  --white: #fff;

  /* lilac */
  --lilac-400: #b795e4;
  --lilac-500: #a583d6;

  /* warm browns (text) */
  --brown-900: #2e1d12;
  --brown-800: #4a3424;
  --brown-500: #8a7260;

  /* see-through browns and lilacs and white (shadows, washes, stripes) */
  --brown-800-a05: rgba(74, 52, 36, 0.05);
  --brown-800-a22: rgba(74, 52, 36, 0.22);
  --brown-800-a25: rgba(74, 52, 36, 0.25);
  --brown-800-a30: rgba(74, 52, 36, 0.3);
  --brown-800-a35: rgba(74, 52, 36, 0.35);
  --brown-800-a40: rgba(74, 52, 36, 0.4);
  --brown-500-a13: rgba(138, 114, 96, 0.13);
  --lilac-400-a18: rgba(183, 149, 228, 0.18);
  --lilac-400-a30: rgba(183, 149, 228, 0.3);
  --lilac-400-a35: rgba(183, 149, 228, 0.35);
  --white-a85: rgba(255, 255, 255, 0.85);

  /* greys (domains are deliberately bland grey folders, SPEC B.b.vii) */
  --grey-100: #e4e1dd;
  --grey-200: #d6d2cd;
  --grey-700: #5f5a55;
  --stone-400: #a39a8e;

  /* reds and oranges (delete, late, warnings) */
  --red-50: #f8dcd6;
  --red-700: #a0442f;
  --red-800: #8a3826;
  --red-900: #7a2d20;
  --orange-500: #d0603a;

  /* the green-to-red priority scale (green is also the "done" green) */
  --scale-1: #4caf6a;
  --scale-2: #a6c34a;
  --scale-3: #f0c040;
  --scale-4: #f08a3c;
  --scale-5: #e5534b;

  /* ---------- 2. roles: colour ---------- */
  /* surfaces */
  --colour-surface-stage: var(--cream-50); /* the calendar stage */
  --colour-surface-frame: var(--cream-100); /* the frame (page background) */
  --colour-surface-control: var(--cream-200); /* buttons / cards on the frame */
  --colour-surface-strong: var(--cream-300); /* hover, today's column tint, selected */
  --colour-surface-field: var(--white); /* inputs, menus, pop-up cards */
  --colour-scrollbar: var(--cream-scroll); /* the draggable part of scrollbars on the stage */

  /* the 10% accent */
  --colour-accent: var(--lilac-400); /* soft lilac */
  --colour-accent-hover: var(--lilac-500);
  --colour-accent-soft: var(--lilac-400-a30); /* a menu item's highlight */
  --colour-selection: var(--lilac-400-a35); /* the time chosen by click and drag */
  --colour-drop-tint: var(--lilac-400-a18); /* where a dragged commitment or domain will land */

  /* text */
  --colour-text: var(--brown-800); /* warm dark brown */
  --colour-text-on-accent: var(--brown-900);
  --colour-text-muted: var(--brown-500);
  --colour-text-on-danger: var(--cream-50);

  /* lines */
  --colour-line: var(--cream-line);
  --colour-line-strong: var(--cream-line-strong);

  /* domains' grey folders */
  --colour-folder: var(--grey-100);
  --colour-folder-hover: var(--grey-200);
  --colour-folder-text: var(--grey-700);

  /* states */
  --colour-done: var(--scale-1); /* the completed-task circle */
  --colour-on-done: var(--white); /* the tick inside it */
  --colour-late: var(--orange-500); /* a task that will finish after its deadline (SPEC C.f) */
  --colour-danger: var(--red-700); /* delete: text and the confirm button */
  --colour-danger-hover: var(--red-800);
  --colour-danger-soft: var(--red-50); /* delete hover, error messages */
  --colour-danger-text: var(--red-900); /* text on the soft red */

  /* washes, shadows, stripes */
  --colour-outside-window: var(--brown-800-a05); /* hours where no task is placed */
  --colour-busy-stripe: var(--brown-500-a13); /* the stripes on a Busy whole-day column */
  --colour-overlay: var(--brown-800-a35); /* dims the page behind a pop-up */
  --colour-shadow-thumb: var(--brown-800-a40);
  --colour-shadow-block: var(--brown-800-a35); /* a block being dragged */
  --colour-shadow-dialog: var(--brown-800-a30);
  --colour-shadow-popover: var(--brown-800-a25);
  --colour-shadow-menu: var(--brown-800-a22);

  /* the priority slider */
  --colour-scale-1: var(--scale-1);
  --colour-scale-2: var(--scale-2);
  --colour-scale-3: var(--scale-3);
  --colour-scale-4: var(--scale-4);
  --colour-scale-5: var(--scale-5);
  --colour-slider-node: var(--white-a85);

  /* an event with no commitment */
  --colour-no-commitment: var(--stone-400);

  /* ---------- 2. roles: type ---------- */
  /* Helvetica where it exists (Mac, iPhone); Windows has none, so Arial, its near twin, shows. */
  --font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;

  --font-size-2xs: 10px;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-md: 14px; /* the page's base size */
  --font-size-lg: 15px;
  --font-size-xl: 17px;
  --font-size-2xl: 18px;
  --font-size-3xl: 20px;
  --font-size-relative-small: 0.85em; /* a little smaller than the text around it */

  --font-weight-normal: 400;
  --font-weight-medium: 600;
  --font-weight-bold: 700;

  --line-height-none: 1;
  --line-height-tight: 1.25;
  --line-height-heading: 1.3;
  --line-height-body: 1.5;

  --letter-spacing-label: 0.04em; /* small capital labels */
  --letter-spacing-grip: -2px; /* pulls the two dots of a drag grip together */

  /* ---------- 2. roles: shape ---------- */
  /* corner radius: named by pixels; 50% is a true circle */
  --radius-1: 1px;
  --radius-3: 3px;
  --radius-4: 4px;
  --radius-6: 6px;
  --radius-8: 8px;
  --radius-10: 10px;
  --radius-12: 12px;
  --radius-15: 15px;
  --radius-17: 17px;
  --radius-round: 50%;
  --radius-block: 5px; /* event, task and travel blocks; the travel curve must equal it (geometry) */

  /* line widths */
  --border-thin: 1px;
  --border-medium: 2px; /* event outlines, the travel dashes */
  --border-thick: 3px;
  --border-check: 1.5px; /* the Done circle */
  --border-ring: 2.5px; /* the ring-and-dot tick-box; its dot sits this far inside the ring */
  --border-stripe: 5px; /* the coloured edge on a task row */

  /* shadows (their colours are in the colour roles above) */
  --shadow-thumb: 0 1px 4px var(--colour-shadow-thumb);
  --shadow-block: 0 4px 14px var(--colour-shadow-block);
  --shadow-popover: 0 4px 18px var(--colour-shadow-popover);
  --shadow-menu: 0 6px 20px var(--colour-shadow-menu);
  --shadow-dialog: 0 12px 40px var(--colour-shadow-dialog);

  /* ---------- 2. roles: space (padding, margins and gaps), named by pixels ---------- */
  --space-1: 1px;
  --space-2: 2px;
  --space-3: 3px;
  --space-4: 4px;
  --space-5: 5px;
  --space-6: 6px;
  --space-7: 7px;
  --space-8: 8px;
  --space-9: 9px;
  --space-10: 10px;
  --space-12: 12px;
  --space-14: 14px;
  --space-15: 15px;
  --space-16: 16px;
  --space-18: 18px;
  --space-20: 20px;
  --space-22: 22px;
  --space-34: 34px;
  --space-40: 40px;

  /* ---------- 2. roles: size (widths and heights), named by pixels ---------- */
  --size-2: 2px;
  --size-5: 5px;
  --size-6: 6px;
  --size-7: 7px;
  --size-8: 8px;
  --size-10: 10px;
  --size-12: 12px;
  --size-13: 13px;
  --size-14: 14px;
  --size-16: 16px;
  --size-18: 18px;
  --size-22: 22px;
  --size-24: 24px;
  --size-28: 28px;
  --size-30: 30px;
  --size-32: 32px;
  --size-34: 34px;
  --size-52: 52px;
  --size-56: 56px;
  --size-60: 60px;
  --size-64: 64px;
  --size-70: 70px;
  --size-84: 84px;
  --size-112: 112px;
  --size-120: 120px;
  --size-130: 130px;
  --size-160: 160px;
  --size-170: 170px;
  --size-200: 200px;
  --size-220: 220px;
  --size-230: 230px;
  --size-250: 250px;
  --size-320: 320px;
  --size-380: 380px;
  --size-440: 440px;
  --size-760: 760px;

  /* ---------- 2. roles: cursors ---------- */
  /* The scissors shown while X is held over the calendar (js/ui/tasks/task-cut.js). */
  --cursor-scissors:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='6' cy='6' r='3'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Cpath d='M8 8L21 19M8 16L21 5'/%3E%3C/svg%3E")
      13 12,
    crosshair;

  /* ---------- 2. roles: motion ---------- */
  --duration-fast: 0.12s;
  --duration-base: 0.2s;
  --ease: ease;

  /* ---------- 2. roles: layers (z-index, low to high) ---------- */
  --layer-block: 1;
  --layer-lifted: 10; /* a block being dragged or hovered */
  --layer-popover: 20; /* the drag-to-create menu */
  --layer-menu: 30; /* drop-downs and the + Add menu */
  --layer-welcome: 40; /* the welcome (sign-in) screen, covering the whole app */

  /* ---------- 2. roles: see-through levels ---------- */
  --opacity-40: 0.4;
  --opacity-50: 0.5;
  --opacity-55: 0.55;
  --opacity-65: 0.65;
  --opacity-80: 0.8;

  /* ---------- geometry: NOT for personalising ----------
     The scripts or the drawing depend on these exact numbers. They are tokens so the link is
     written down in one place; the scripts read them with js/ui/shared/design-tokens.js. */
  --hour-height: 62px; /* height of one hour row on the grid */
  --event-gutter: 7px; /* free strip at the right edge of a day column; event blocks stop short of it */
  --time-col: 56px; /* width of the left column of hour labels */
  --min-block-height: 16px; /* the shortest a block is drawn, so a 5-minute event can still be clicked */
  --drag-threshold: 4px; /* how far the mouse travels before a press counts as a drag, not a click */
  --window-hour-height: 30px; /* height of one hour in a commitment's schedule windows week */
  --stripe-width: 7px; /* the Busy stripes: one band... */
  --stripe-period: 14px; /* ...and one band plus its gap; Busy travel stripes must line up with these */
  --stripe-reach: 2000px; /* how tall the travel stripes' pattern is drawn */
  --travel-cut: 3px; /* how deep the travel strip is cut where it meets its block (deeper than the 2px line) */
}
