/* ezProjekt design tokens. Mirrors the annex of .github/skills/designing-projekt-ui/SKILL.md. */
/* 2.27a: scales shared by both modes (space, radius, type, motion). Only colours change per mode. */
:root {
  /* 2.27e: only for hairline gaps between very small marks (the activity grid). */
  --space-half: 2px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 999px;
  --radius-round: 50%;
  /* Concentric radii: a container sets --radius-outer and --pad; what it holds uses --radius-inner (see below). */
  --radius-outer: var(--radius-xl);
  --pad: var(--space-4);

  --text-2xs: .6875rem;
  --text-xs: .75rem;
  --text-sm: .8125rem;
  --text-md: .875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 3rem;

  --sidebar-w: 264px;
  --rail-w: 72px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-brand: 'Outfit', var(--font);
  --border: 1px;
  --ring: 2px;

  /* 2.26a: motion. No literal durations in component rules; springs come from src/domain/motion.ts (a test keeps them equal). */
  --dur-micro: 120ms;
  --dur-short: 180ms;
  --dur-panel: 260ms;
  --dur-long: 360ms;
  /* 2.27k: Jekt's sphere under the pointer: it lights up in 200 ms (ease-out) and goes back in 300 ms (ease-in). */
  --dur-hover-in: 200ms;
  --dur-hover-out: 300ms;
  /* 2.27k (Gerard, 2026-11-18): opening Jekt's space is a rare, important moment (B10): the sphere flies for about a second
     (an exception to B9, always interruptible), after a short anticipation (B2); it flies back in 700 ms. */
  --dur-flight: 1000ms;
  --dur-flight-back: 700ms;
  --dur-anticipate: 90ms;
  /* 2.48b (Gerard's taste, lot 27: large, slow and fluid): «Jekt descansa» comes in over about a second; rare (B10). */
  --dur-rest: 1000ms;
  /* 2.27k: Home's cards displaced by a drag slide in 200 ms (B9). */
  --dur-reorder: 200ms;
  /* 2.27l: a menu or floating panel comes from its button and goes back (B9). */
  --dur-menu: 150ms;
  /* 2.27m: Jekt's cards fold away with a 200 ms fade when a conversation starts (B9). */
  --dur-fold: 200ms;
  /* Lot 53 (2.53a): the big celebration's box (ring and particles, seguir); it lasts 900 ms (domain/completion.ts). */
  --celebration-size: calc(var(--space-12) * 3);
  --orb-hover-scale: 1.06;
  --orb-press-scale: .95;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.5, 0, .75, 0);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --spring-soft: linear(0, 0.041, 0.133, 0.256, 0.393, 0.531, 0.661, 0.777, 0.875, 0.954, 1.014, 1.056, 1.083, 1.097, 1.1, 1.097, 1.088, 1.075, 1.062, 1.048, 1.035, 1.023, 1.013, 1.005, 0.999, 0.995, 0.992, 0.99, 0.99, 0.99, 0.991, 0.992, 0.994, 0.995, 0.996, 0.998, 0.999, 0.999, 1, 1);
  --spring-soft-dur: 771ms;
  --spring-snappy: linear(0, 0.03, 0.092, 0.174, 0.269, 0.367, 0.466, 0.559, 0.645, 0.723, 0.791, 0.849, 0.897, 0.937, 0.968, 0.992, 1.01, 1.023, 1.031, 1.036, 1.038, 1.038, 1.036, 1.033, 1.03, 1.026, 1.022, 1.019, 1.015, 1.012, 1.009, 1.007, 1.005, 1.003, 1.002, 1.001, 1, 0.999, 0.999, 1);
  --spring-snappy-dur: 417ms;
  --stagger: 30ms;
  /* Line shadows (dividers, the selected-item bar, the inset ring): geometry here, colour from the mode. */
  --shadow-indicator: inset 3px 0 0 var(--accent);
  --shadow-indicator-focus: inset 3px 0 0 var(--focus);
  --divider-bottom: inset 0 -1px 0 var(--glass-2-border);
  --divider-right: inset -1px 0 0 var(--glass-1-border);
  --divider-corner: inset -1px -1px 0 var(--glass-1-border);
  --ring-inset: inset 0 0 0 var(--ring) var(--accent);
  /* 2.27b: hit areas (B14: 32 px on desktop), the masked edge of scrolling lists (C2) and the icon swap's blur (C4). */
  --hit: 32px;
  --fade: var(--space-6);
  --mask-solid: oklch(0 0 0);
  --blur-icon: blur(3px);
  /* B1: what is pressed squashes 4 %. */
  --press-scale: .96;
  /* 2.49g (lot 49): Home's free board: the height of a row of its 12-column grid, the resize edges (pointer only) and the
     corner, a full 24 px target (WCAG 2.5.8). */
  --board-row: 40px;
  --board-edge: 8px;
  --board-corner: 24px;
  /* 2.49a (lot 49): the height of a chart drawn with the own layers (components/charts/). */
  --chart-height: calc(var(--space-12) * 4);
}

/* Recomputed on every element from the --radius-outer and --pad it inherits from its container (decision 3). */
*, *::before, *::after { --radius-inner: max(0px, calc(var(--radius-outer) - var(--pad))); }

/* 2.27a: Bàsic, dark (also the default before the app sets data-mode). Monochrome: near-black page, white text;
   elevation is lighter surfaces; colour is kept for states (buffer, Jekt, errors) and charts. */
:root, :root[data-mode="dark"] {
  color-scheme: dark;
  --surface-0: oklch(0.155 0 0);
  --surface-1: oklch(0.195 0 0);
  --surface-2: oklch(0.23 0 0);
  --surface-3: oklch(0.265 0 0);
  --surface-overlay: oklch(0.29 0 0);
  --surface-data: oklch(0.18 0 0);
  --bg-base: var(--surface-0);

  --glass-1: oklch(0.195 0 0 / .91);
  --glass-2: oklch(0.23 0 0 / .92);
  --glass-3: oklch(0.265 0 0 / .95);
  --glass-1-border: oklch(1 0 0 / .09);
  --glass-2-border: oklch(1 0 0 / .13);
  --glass-3-border: oklch(1 0 0 / .18);
  --scrollbar-thumb: oklch(1 0 0 / .24);
  --border-strong: oklch(1 0 0 / .55);
  --control-border: oklch(1 0 0 / .4);
  --blur-2: blur(12px) saturate(120%);
  --blur-3: blur(16px) saturate(120%);
  --highlight: inset 0 1px 0 oklch(1 0 0 / .07);
  --shadow-1: 0 1px 2px oklch(0 0 0 / .4);
  --shadow-2: 0 8px 24px oklch(0 0 0 / .45);
  --shadow-3: 0 16px 40px oklch(0 0 0 / .55);
  --scrim: oklch(0.1 0 0 / .72);

  --text-primary: oklch(0.97 0 0);
  --text-secondary: oklch(0.8 0 0);
  --text-soft: oklch(0.68 0 0);
  --accent: oklch(0.97 0 0);
  --text-on-accent: oklch(0.155 0 0);
  --focus: oklch(0.72 0.14 255);

  /* State colours with close perceived lightness (C5). */
  --buffer-green: oklch(0.78 0.15 160);
  --buffer-yellow: oklch(0.82 0.15 85);
  --buffer-red: oklch(0.72 0.16 22);
  /* Chart series (2.27a): apart from the buffer hues; the fifth is neutral. */
  --chart-1: oklch(0.74 0.13 255);
  --chart-2: oklch(0.74 0.13 305);
  --chart-3: oklch(0.76 0.11 200);
  --chart-4: oklch(0.74 0.14 345);
  --chart-5: oklch(0.74 0 0);

  /* Clay: only what is pressed (primary button, the done box, create from a template). */
  --clay-top: oklch(0.99 0 0);
  --clay-bottom: oklch(0.86 0 0);
  --clay-gradient: linear-gradient(in oklch 160deg, var(--clay-top), var(--clay-bottom));
  --clay-inset: inset 0 1px 1px oklch(1 0 0 / .8), inset 0 -3px 6px oklch(0 0 0 / .16);
  --clay-glow: 0 6px 16px oklch(0 0 0 / .5);
  --text-on-clay: oklch(0.155 0 0);
  --blend: screen;

  /* 2.26a: Jekt's states (= the mids of ORB_PALETTES.dark, a test keeps them equal). Graphic use: ≥ 3:1. */
  --jekt-rest: var(--text-primary);
  --jekt-listening: oklch(0.518 0.198 265.2);
  --jekt-working: oklch(0.837 0.164 84.4);
  --jekt-done: oklch(0.773 0.153 163.2);
  --jekt-alert: oklch(0.711 0.166 22.2);
  /* 2.26d: the layer under Jekt's space: darkens the app, no blur. */
  --jekt-space-layer: oklch(0.155 0 0 / .84);
  /* 2.27k: the brightest dot of the app's grid (GRID_LOOK.app.lit, .9): the contrast test puts it under every surface (blurred
     under the liquid glass, sharp under the rest). */
  --grid-dot-lit: oklch(0.97 0 0 / .9);
  /* 2.27k: liquid glass (cards, sidebar, menus, dialogs): a faint fill the dots shine through as soft lights, a blur that keeps
     them round, an edge lit from the top left (B11), a thin specular line on top, a sheen and a wide soft shadow. Raised glass
     (menus, dialogs) is lighter and fuller (C7). */
  --glass-fill: oklch(1 0 0 / .07);
  /* 2.27m: the neutral light pill under a colour brand logo, the same in dark and in light (so the logo keeps its colours). */
  --brand-pill: oklch(.97 0 0);
  --brand-pill-edge: oklch(0 0 0 / .08);
  /* lot 60 (2.60f): the brand buttons, the only exception to black and white (each brand's rules, dark theme). */
  --brand-google-fill: oklch(0.1872 0.002 286.2);
  --brand-google-edge: oklch(0.6535 0.0046 157.1);
  --brand-google-text: oklch(0.9158 0 0);
  --brand-ms-fill: oklch(0.3052 0 0);
  --brand-ms-edge: oklch(0.3052 0 0);
  --brand-ms-text: oklch(1 0 0);
  --glass-fill-raised: oklch(0.3 0 0 / .8);
  --glass-sheen: oklch(1 0 0 / .05);
  --glass-spot: oklch(1 0 0 / .1);
  --glass-blur: 6px;
  --glass-edge: linear-gradient(in oklch 135deg, oklch(1 0 0 / .42), oklch(1 0 0 / .1) 45%, oklch(1 0 0 / .02));
  --glass-highlight: oklch(1 0 0 / .16);
  --glass-shadow: 0 16px 40px oklch(0 0 0 / .4);
}

/* 2.27a: Bàsic, light: the inverse. A data-palette (Zen, Natural) would redefine only these colours. */
:root[data-mode="light"] {
  color-scheme: light;
  --surface-0: oklch(0.965 0 0);
  --surface-1: oklch(0.98 0 0);
  --surface-2: oklch(0.99 0 0);
  --surface-3: oklch(1 0 0);
  --surface-overlay: oklch(1 0 0);
  --surface-data: oklch(1 0 0);
  --bg-base: var(--surface-0);

  --glass-1: oklch(1 0 0 / .92);
  --glass-2: oklch(1 0 0 / .9);
  --glass-3: oklch(1 0 0 / .95);
  --glass-1-border: oklch(0 0 0 / .08);
  --glass-2-border: oklch(0 0 0 / .12);
  --glass-3-border: oklch(0 0 0 / .16);
  --scrollbar-thumb: oklch(0 0 0 / .24);
  --border-strong: oklch(0 0 0 / .55);
  --control-border: oklch(0 0 0 / .46);
  --blur-2: blur(12px) saturate(120%);
  --blur-3: blur(16px) saturate(120%);
  --highlight: inset 0 1px 0 oklch(1 0 0 / .7);
  --shadow-1: 0 1px 2px oklch(0 0 0 / .08);
  --shadow-2: 0 8px 24px oklch(0 0 0 / .1);
  --shadow-3: 0 16px 40px oklch(0 0 0 / .14);
  --scrim: oklch(0.2 0 0 / .32);

  --text-primary: oklch(0.18 0 0);
  --text-secondary: oklch(0.38 0 0);
  --text-soft: oklch(0.5 0 0);
  --accent: oklch(0.18 0 0);
  --text-on-accent: oklch(0.98 0 0);
  --focus: oklch(0.49 0.2 262);

  --buffer-green: oklch(0.5 0.12 155);
  --buffer-yellow: oklch(0.52 0.12 65);
  --buffer-red: oklch(0.53 0.2 27);
  --chart-1: oklch(0.52 0.16 255);
  --chart-2: oklch(0.52 0.16 305);
  --chart-3: oklch(0.54 0.1 200);
  --chart-4: oklch(0.54 0.17 345);
  --chart-5: oklch(0.52 0 0);

  --clay-top: oklch(0.32 0 0);
  --clay-bottom: oklch(0.14 0 0);
  --clay-gradient: linear-gradient(in oklch 160deg, var(--clay-top), var(--clay-bottom));
  --clay-inset: inset 0 1px 1px oklch(1 0 0 / .22), inset 0 -3px 6px oklch(0 0 0 / .45);
  --clay-glow: 0 6px 16px oklch(0 0 0 / .22);
  --text-on-clay: oklch(0.98 0 0);
  --blend: multiply;

  /* = the mids of ORB_PALETTES.light. */
  --jekt-rest: var(--text-primary);
  --jekt-listening: oklch(0.488 0.217 264.4);
  --jekt-working: oklch(0.63 0.15 58);
  --jekt-done: oklch(0.596 0.127 163.2);
  --jekt-alert: oklch(0.577 0.215 27.3);
  --jekt-space-layer: oklch(0.965 0 0 / .84);
  --grid-dot-lit: oklch(0.18 0 0 / .9);
  --glass-fill: oklch(1 0 0 / .48);
  /* 2.27m: the same pill as in dark, on purpose (the colour logos keep their colours in both modes). */
  --brand-pill: oklch(.97 0 0);
  --brand-pill-edge: oklch(0 0 0 / .08);
  /* lot 60 (2.60f): the brand buttons (each brand's rules, light theme). */
  --brand-google-fill: oklch(1 0 0);
  --brand-google-edge: oklch(0.566 0.0047 157.1);
  --brand-google-text: oklch(0.2393 0 0);
  --brand-ms-fill: oklch(1 0 0);
  --brand-ms-edge: oklch(0.6401 0 0);
  --brand-ms-text: oklch(0.4819 0 0);
  --glass-fill-raised: oklch(1 0 0 / .84);
  --glass-sheen: oklch(1 0 0 / .4);
  --glass-spot: oklch(1 0 0 / .55);
  --glass-blur: 6px;
  --glass-edge: linear-gradient(in oklch 135deg, oklch(1 0 0 / .95), oklch(1 0 0 / .45) 45%, oklch(0 0 0 / .06));
  --glass-highlight: oklch(1 0 0 / .9);
  --glass-shadow: 0 16px 40px oklch(0 0 0 / .1);
}

/* 2.26a: with reduced motion every duration is 0 and springs are plain (animations become instant). */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-micro: 0ms;
    --dur-short: 0ms;
    --dur-panel: 0ms;
    --dur-long: 0ms;
    --dur-hover-in: 0ms;
    --dur-hover-out: 0ms;
    --dur-flight: 0ms;
    --dur-flight-back: 0ms;
    --dur-anticipate: 0ms;
    --dur-rest: 0ms;
    --dur-reorder: 0ms;
    --dur-menu: 0ms;
    --dur-fold: 0ms;
    --orb-hover-scale: 1;
    --orb-press-scale: 1;
    --spring-soft: linear;
    --spring-soft-dur: 0ms;
    --spring-snappy: linear;
    --spring-snappy-dur: 0ms;
    --stagger: 0ms;
    --press-scale: 1;
  }
}

/* Static background everywhere (only Jekt's space has its dot grid). */
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font);
}

/* Glass is the base surface. 2.27k: liquid glass on cards, the sidebar, menus and dialogs: a faint fill with a soft blur, so
   the dot grid shines through as soft lights; an edge lit from the top left that fades towards the bottom right (an alpha
   gradient through a mask, never an opaque grey: C3); a thin specular line on top and a sheen that follows the cursor a
   little on the card under it (--spec-x, --spec-y, from glassLight.ts); raised glass (menus, dialogs) lighter, fuller and with a
   wide soft shadow (C7). One light (B11). */
.glass-1, .glass-2, .glass-3 {
  border: var(--border) solid transparent;
  border-radius: var(--radius-outer);
  background:
    radial-gradient(in oklch circle at var(--spec-x, 15%) var(--spec-y, -30%), var(--glass-spot), transparent 45%),
    linear-gradient(in oklch to bottom, var(--glass-sheen), transparent 60%),
    var(--glass-fill);
  /* Blur only: a saturate() as well doubled the frame time over the moving grid (NIGHT_LOG, 2.27k pas 1B). */
  backdrop-filter: blur(var(--glass-blur));
  /* Only the specular line: an outer shadow on a surface that blurs a moving grid made the compositor redraw a wider area
     every frame (NIGHT_LOG, 2.27k pas 1B). Depth on the cards comes from the lit edge and the fill; raised glass keeps it. */
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
:where(.glass-1, .glass-2, .glass-3):not(dialog, [popover]) { position: relative; }
.glass-1::before, .glass-2::before, .glass-3::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--border));
  padding: var(--border);
  border-radius: inherit;
  background: var(--glass-edge);
  mask: linear-gradient(var(--mask-solid) 0 0) content-box exclude, linear-gradient(var(--mask-solid) 0 0);
  pointer-events: none;
}
.glass-3 {
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--glass-shadow);
  background:
    radial-gradient(in oklch circle at var(--spec-x, 15%) var(--spec-y, -30%), var(--glass-spot), transparent 45%),
    linear-gradient(in oklch to bottom, var(--glass-sheen), transparent 60%),
    var(--glass-fill-raised);
}
/* Repeated items: the tint and the edge, without blur. */
.glass-static { backdrop-filter: none; }

.surface-data { background: var(--surface-data); border: var(--border) solid var(--glass-1-border); border-radius: var(--radius-outer); }

/* Clay: only on what is pressed; it squashes 4 % (B1). */
.clay {
  background: var(--clay-gradient);
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--clay-inset), var(--clay-glow);
  color: var(--text-on-clay);
  font-weight: 700;
}

:focus-visible { outline: var(--ring) solid var(--focus); outline-offset: var(--ring); }

@media (prefers-reduced-transparency: reduce) {
  :root, :root[data-mode] {
    --glass-1: var(--surface-1);
    --glass-2: var(--surface-2);
    --glass-3: var(--surface-3);
  }
  .glass-1, .glass-2, .glass-3 { background: var(--surface-2); backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root, :root[data-mode] {
    --glass-1-border: var(--border-strong);
    --glass-2-border: var(--border-strong);
    --glass-3-border: var(--border-strong);
    --control-border: var(--border-strong);
    --text-soft: var(--text-secondary);
  }
}

/* Lot 57 (2.57f): Jekt beside the task: the panel's width, the column it gains on the left, and the beacon's pulse (baliza),
   shown once in the app. */
:root {
  --task-panel-width: 460px;
  --jekt-column: 380px;
  --dur-beacon: 2600ms;
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur-beacon: 0ms; }
}
