/* Trackshot product UI tokens (direction 5.7 A, "Play")
 * Dark is the default theme; light is opt-in with [data-theme="light"] on <html>.
 * Every value in the product maps to one of these. No raw hex in components.
 * Fonts: Geist and Geist Mono (Google Fonts or the `geist` npm package), SIL OFL.
 */
:root {
  color-scheme: dark;

  /* ---------- Brand primitives ---------- */
  --ts-sumi: #141210;           /* ink: the ground */
  --ts-washi: #F3EFE6;          /* paper: the figure, primary text */
  --ts-shu: #E2421F;            /* vermilion: the play button, graphics only (not small text, not button fills) */

  /* ---------- Surfaces (same warm hue, lightness only) ---------- */
  --ts-canvas: #141210;         /* app background; sidebar uses this too */
  --ts-surface: #191613;        /* panels that sit on the canvas (inspector, composer tray) */
  --ts-raised: #1E1B18;         /* cards, user message, list rows on hover */
  --ts-overlay: #26221E;        /* menus, popovers, tooltips, dialogs */
  --ts-inset: #0F0D0C;          /* inputs and wells: darker than their surroundings */
  --ts-scrim: rgba(10, 9, 8, .72);
  --ts-scrim-media: rgba(20, 18, 16, .55);  /* over footage and stills, so the same in both themes. Added in the repo, 7 Oct */

  /* ---------- Text (four levels) ---------- */
  --ts-text: #F3EFE6;           /* primary          16.3:1 on canvas */
  --ts-text-2: #C4BEB3;         /* secondary        10.1:1 */
  --ts-text-3: #8E877C;         /* tertiary, meta    5.3:1 */
  --ts-text-4: #5F5951;         /* placeholder, disabled only (2.7:1, exempt) */
  --ts-text-on-action: #F3EFE6;

  /* ---------- Lines (washi at low alpha, never solid) ---------- */
  --ts-line-soft: rgba(243, 239, 230, .06);
  --ts-line: rgba(243, 239, 230, .10);
  --ts-line-strong: rgba(243, 239, 230, .18);
  --ts-seam: var(--ts-canvas);  /* the 2px gap between grouped controls, like the mark's seams */

  /* ---------- Action (vermilion, accessible) ---------- */
  --ts-action: #C2340F;         /* primary button fill: 4.8:1 with washi text */
  --ts-action-hover: #B02D0B;
  --ts-action-press: #9C280A;
  --ts-action-text: #F0623F;    /* vermilion as text or link on dark: 5.8:1 */
  --ts-action-tint: rgba(226, 66, 31, .14);   /* selected rows, active tabs */
  --ts-focus: #E2421F;          /* 2px focus ring, 2px offset */

  /* ---------- Semantic (from the same world: matcha, kohaku, enji, ai) ---------- */
  --ts-ok: #8DB580;             /* matcha  8.1:1 */
  --ts-warn: #E0A84E;           /* kohaku (amber) 8.8:1 */
  --ts-danger: #BA2830;         /* enji (cochineal carmine): error marks, borders, fills. Graphic 3.1:1; never small text on dark */
  --ts-danger-fill: #BA2830;    /* destructive button, error badge: 5.3:1 with washi */
  --ts-danger-hover: #A3222A;
  --ts-on-danger: #F3EFE6;
  --ts-danger-text: #F3EFE6;    /* error message text sits beside a filled enji mark, so it stays washi on dark */
  --ts-info: #7C9BE0;           /* ai (indigo) 6.8:1 */
  --ts-rec: var(--ts-shu);      /* recording / live */
  --ts-ok-tint: rgba(141, 181, 128, .14);
  --ts-warn-tint: rgba(224, 168, 78, .14);
  --ts-danger-tint: rgba(186, 40, 48, .22);
  --ts-info-tint: rgba(124, 155, 224, .14);

  /* ---------- Typography ---------- */
  --ts-font: "Geist", "Helvetica Neue", Arial, sans-serif;
  --ts-font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ts-weight-regular: 400;
  --ts-weight-medium: 500;
  --ts-weight-semibold: 600;    /* numbers in stats only; headings use 500 */

  /* Type scale, web (comfortable). Desktop overrides below. size / line-height / tracking */
  --ts-display: 500 40px/44px var(--ts-font);      --ts-display-track: -0.02em;
  --ts-title-1: 500 28px/34px var(--ts-font);      --ts-title-1-track: -0.015em;
  --ts-title-2: 500 22px/28px var(--ts-font);      --ts-title-2-track: -0.01em;
  --ts-title-3: 500 18px/24px var(--ts-font);      --ts-title-3-track: -0.005em;
  --ts-body-lg: 400 17px/26px var(--ts-font);      /* reading: agent answers, docs */
  --ts-body: 400 15px/22px var(--ts-font);         /* default UI text */
  --ts-body-sm: 400 13px/18px var(--ts-font);
  --ts-label: 500 14px/20px var(--ts-font);        /* buttons, inputs, nav, tabs */
  --ts-caption: 400 12px/16px var(--ts-font);      --ts-caption-track: 0.01em;
  --ts-eyebrow: 500 11px/14px var(--ts-font-mono); --ts-eyebrow-track: 0.12em;   /* uppercase */
  --ts-mono: 400 13px/18px var(--ts-font-mono);    /* timecodes, sizes, counts: tabular-nums */
  --ts-brand-caps: 600 15px/20px var(--ts-font);   --ts-brand-caps-track: -0.025em; /* "Trackshot" in sentence case beside the mark, as the wordmark (20 Oct 2026: no longer spaced caps; never uppercase) */
  --ts-stat: 600 56px/60px var(--ts-font-mono);   /* added for the app (7 Oct 2026): one large numeric stat, the credit balance; 600 per §3 */

  /* ---------- Spacing (4px base) ---------- */
  --ts-space-0-5: 2px;  --ts-space-1: 4px;   --ts-space-1-5: 6px;  --ts-space-2: 8px;
  --ts-space-3: 12px;   --ts-space-4: 16px;  --ts-space-5: 20px;   --ts-space-6: 24px;
  --ts-space-8: 32px;   --ts-space-10: 40px; --ts-space-12: 48px;  --ts-space-16: 64px; --ts-space-20: 80px;

  /* ---------- Radius ---------- */
  --ts-radius-xs: 4px;    /* checkboxes, tags, kbd */
  --ts-radius-sm: 6px;    /* small buttons and inputs */
  --ts-radius-md: 8px;    /* buttons, inputs, menu items */
  --ts-radius-lg: 12px;   /* cards, messages, popovers */
  --ts-radius-xl: 16px;   /* panels, dialogs */
  --ts-radius-2xl: 24px;  /* sheets, the video player */
  --ts-radius-full: 999px;

  /* ---------- Control sizes (web) ---------- */
  --ts-control-sm: 32px;  --ts-control-md: 36px;  --ts-control-lg: 44px;
  --ts-icon: 20px;        --ts-icon-sm: 16px;     --ts-icon-stroke: 1.5px;
  --ts-agent-mark: 28px;  --ts-mark-lg: 48px;      /* the agent mark beside its status (§7); the still mark on empty and loading screens (§94). Added in the repo, 7 Oct */

  /* ---------- Elevation: surface shift + hairline; shadow only on overlays ---------- */
  --ts-shadow-overlay: 0 12px 32px -8px rgba(0, 0, 0, .55), 0 0 0 1px var(--ts-line);
  --ts-composer: #1E1B18;   /* the composer sits above the page (7 Oct): raised in dark, white in light */
  --ts-composer-fill: #2A2621;   /* a quiet fill inside the composer: the Send disc with nothing to send */
  --ts-shadow-raise: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .7);         /* the composer */
  --ts-shadow-raise-focus: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 36px -14px rgba(0, 0, 0, .8);
  --ts-thumb: #2A2621;      /* a switch's selected side */
  --ts-lane: #1E1B18;       /* a timeline lane's ground (the voice wave) */
  --ts-clip: #34302A;       /* a block on the timeline: captions, title and music bars, chips; visible on the canvas in both themes */
  --ts-shadow-thumb: 0 1px 2px rgba(0, 0, 0, .45);
  --ts-shadow-dialog: 0 24px 64px -12px rgba(0, 0, 0, .65), 0 0 0 1px var(--ts-line);

  /* ---------- Motion ---------- */
  --ts-dur-instant: 80ms;   /* press, toggle */
  --ts-dur-fast: 140ms;     /* hover, focus */
  --ts-dur-base: 200ms;     /* popovers, tabs, small enters */
  --ts-dur-slow: 320ms;     /* panels, sheets, dialogs */
  --ts-dur-agent: 600ms;    /* the mark changing tools */
  --ts-dur-agent-hold: 1600ms; /* minimum time a tool stays on screen */
  --ts-ease: cubic-bezier(.2, 0, 0, 1);         /* standard: decelerate */
  --ts-ease-enter: cubic-bezier(0, 0, .2, 1);
  --ts-ease-exit: cubic-bezier(.4, 0, 1, 1);
  --ts-ease-brand: cubic-bezier(.34, 1.56, .64, 1);  /* overshoot: the mark only, never UI chrome */

  /* ---------- Layout ---------- */
  --ts-sidebar: 240px;   --ts-sidebar-collapsed: 56px;
  --ts-topbar: 56px;     --ts-inspector: 320px;
  --ts-chat-column: 720px;   /* about 70 characters of body-lg */
  --ts-gutter: 24px;

  /* ---------- Layers ---------- */
  --ts-z-sticky: 10; --ts-z-dropdown: 100; --ts-z-overlay: 200; --ts-z-modal: 300; --ts-z-toast: 400;
}

/* Desktop app (Electron/Tauri, or any pointer-first window): denser scale and controls */
:root[data-density="desktop"], .ts-desktop {
  --ts-display: 500 32px/36px var(--ts-font);
  --ts-title-1: 500 24px/30px var(--ts-font);
  --ts-title-2: 500 20px/26px var(--ts-font);
  --ts-title-3: 500 16px/22px var(--ts-font);
  --ts-body-lg: 400 15px/22px var(--ts-font);
  --ts-body: 400 13px/20px var(--ts-font);
  --ts-body-sm: 400 12px/16px var(--ts-font);
  --ts-label: 500 13px/16px var(--ts-font);
  --ts-caption: 400 11px/14px var(--ts-font);
  --ts-eyebrow: 500 10px/12px var(--ts-font-mono);
  --ts-mono: 400 12px/16px var(--ts-font-mono);
  --ts-brand-caps: 600 14px/18px var(--ts-font);
  --ts-stat: 600 44px/48px var(--ts-font-mono);
  --ts-control-sm: 24px; --ts-control-md: 28px; --ts-control-lg: 32px;
  --ts-icon: 16px; --ts-icon-sm: 14px; --ts-agent-mark: 24px;
  --ts-topbar: 48px; --ts-gutter: 16px;
}

/* Light theme: a near-white page with white surfaces and quiet warm-grey fills (changed from washi by Anish, 7 Oct 2026) */
:root[data-theme="light"] {
  color-scheme: light;
  --ts-canvas: #FAFAF8;
  --ts-surface: #FFFFFF;
  --ts-raised: #F2F1EE;      /* fills: the user message, chips, a switch's track */
  --ts-overlay: #FFFFFF;
  --ts-inset: #FFFFFF;       /* light inputs are white with a line; depth comes from the line and shadow */
  --ts-scrim: rgba(20, 18, 16, .4);
  --ts-text: #141210;          /* 16.3:1 */
  --ts-text-2: #4A453E;        /*  8.3:1 */
  --ts-text-3: #6F685E;        /*  4.8:1 */
  --ts-text-4: #A39C90;
  --ts-line-soft: rgba(20, 18, 16, .06);
  --ts-line: rgba(20, 18, 16, .10);
  --ts-line-strong: rgba(20, 18, 16, .20);
  --ts-seam: #FAFAF8;          /* redeclared: var() references resolve where declared */
  --ts-action-text: #C2340F;   /* 4.8:1 on washi */
  --ts-action-tint: rgba(226, 66, 31, .10);
  --ts-ok: #466B3B;            /* 5.3:1 */
  --ts-warn: #8A5A0E;          /* 5.2:1 */
  --ts-danger: #BA2830;        /* 5.3:1 on washi */
  --ts-danger-fill: #BA2830;
  --ts-danger-text: #BA2830;   /* on light, enji works as text */
  --ts-danger-tint: rgba(186, 40, 48, .10);
  --ts-info: #3557A7;          /* 6.0:1 */
  --ts-shadow-overlay: 0 12px 32px -8px rgba(20, 18, 16, .18), 0 0 0 1px var(--ts-line);
  --ts-composer: #FFFFFF;
  --ts-composer-fill: #F2F1EE;
  --ts-shadow-raise: 0 1px 2px rgba(20, 18, 16, .04), 0 8px 24px -12px rgba(20, 18, 16, .14);
  --ts-shadow-raise-focus: 0 1px 2px rgba(20, 18, 16, .05), 0 12px 32px -12px rgba(20, 18, 16, .2);
  --ts-thumb: #FFFFFF;
  --ts-lane: #F0EFEB;
  --ts-clip: #DEDCD6;
  --ts-shadow-thumb: 0 1px 2px rgba(20, 18, 16, .10), 0 0 0 1px rgba(20, 18, 16, .04);
  --ts-shadow-dialog: 0 24px 64px -12px rgba(20, 18, 16, .24), 0 0 0 1px var(--ts-line);
}

@media (prefers-reduced-motion: reduce) {
  :root { --ts-dur-fast: 0ms; --ts-dur-base: 0ms; --ts-dur-slow: 0ms; --ts-dur-agent: 200ms; }
}
