/* Legacy variable names → design tokens (authenticated app and sign-in pages only).
 *
 * style.css, workspace.css, cally.css and the page templates grew up on a different set of variable names
 * (--color-primary, --bg-elevated, --text-muted, ...). This file keeps those names working by pointing every one of
 * them at a token in tokens.css, so there is ONE definition per value. Do not add new values here, and do not use
 * these names in new code: use the --ds-* tokens directly.
 *
 * Not loaded on public marketing pages: their section themes reuse some of the same names for different purposes.
 * Loaded right after style.css; the doubled :root raises specificity above the theme blocks in older files.
 */
:root:root {
    --color-primary: var(--ds-primary);
    --color-primary-btn: var(--ds-primary-solid);
    --color-primary-hover: var(--ds-primary-hover);
    --color-primary-btn-hover: var(--ds-primary-solid-hover);
    --color-primary-btn-active: var(--ds-primary-solid-active);
    --color-primary-light: var(--ds-primary-tint);
    --color-primary-subtle: var(--ds-primary-subtle);
    --color-success: var(--ds-success);
    --color-success-light: var(--ds-success-subtle);
    --color-warning: var(--ds-warning);
    --color-warning-hover: var(--ds-warning);
    --color-warning-dark: var(--ds-warning-strong);
    --color-warning-light: var(--ds-warning-subtle);
    --color-error: var(--ds-error);
    --color-error-hover: var(--ds-error);
    --color-error-dark: var(--ds-error-strong);
    --color-error-light: var(--ds-error-subtle);
    --color-error-subtle: var(--ds-error-subtle);
    --color-info: var(--ds-info);
    --color-info-light: var(--ds-info-subtle);
    --color-danger: var(--ds-error);
    --danger: var(--ds-error);
    --success: var(--ds-success);
    --warning: var(--ds-warning);

    --color-white: var(--ds-surface);
    --color-gray-50: var(--ds-gray-50);
    --color-gray-100: var(--ds-gray-100);
    --color-gray-200: var(--ds-gray-200);
    --color-gray-300: var(--ds-gray-300);
    --color-gray-400: var(--ds-gray-400);
    --color-gray-500: var(--ds-gray-500);
    --color-gray-600: var(--ds-gray-600);
    --color-gray-700: var(--ds-gray-700);
    --color-gray-800: var(--ds-gray-800);
    --color-gray-900: var(--ds-gray-900);

    --bg-primary: var(--ds-background);
    --bg-secondary: var(--ds-background-subtle);
    --bg-tertiary: var(--ds-background-muted);
    --bg-inverse: var(--ds-background);
    --bg-elevated: var(--ds-surface);
    --bg-surface: var(--ds-surface);
    --bg-card: var(--ds-surface);
    --card-bg: var(--ds-surface);
    --color-surface: var(--ds-surface);
    --bg-hover: var(--ds-surface-hover);
    --text-primary: var(--ds-text);
    --text-secondary: var(--ds-text);
    --text-tertiary: var(--ds-muted);
    --text-muted: var(--ds-muted);
    --text-dim: var(--ds-muted);
    --text-inverse: var(--ds-text-inverse);
    --border-color: var(--ds-border);
    --border-default: var(--ds-border);
    --border-primary: var(--ds-border-subtle);
    --border-secondary: var(--ds-border-strong);
    --border-focus: var(--ds-primary);

    --font-sans: var(--ds-font-sans);
    --font-mono: var(--ds-font-mono);
    --text-2xs: var(--ds-text-2xs);
    --text-xs: var(--ds-text-xs);
    --text-sm: var(--ds-text-sm);
    --text-base: var(--ds-text-base);
    --text-md: var(--ds-text-md);
    --text-lg: var(--ds-text-lg);
    --text-xl: var(--ds-text-xl);
    --text-2xl: var(--ds-text-2xl);
    --text-3xl: var(--ds-text-3xl);
    --text-4xl: var(--ds-text-4xl);
    --text-5xl: var(--ds-text-5xl);
    --leading-none: var(--ds-leading-none);
    --leading-tight: var(--ds-leading-tight);
    --leading-snug: var(--ds-leading-snug);
    --leading-normal: var(--ds-leading-normal);
    --leading-relaxed: var(--ds-leading-relaxed);
    --font-normal: var(--ds-weight-normal);
    --font-medium: var(--ds-weight-medium);
    --font-semibold: var(--ds-weight-semibold);
    --font-bold: var(--ds-weight-bold);
    --font-extrabold: var(--ds-weight-extrabold);
    --tracking-tight: var(--ds-tracking-tight);
    --tracking-snug: var(--ds-tracking-snug);
    --tracking-normal: var(--ds-tracking-normal);
    --tracking-wide: var(--ds-tracking-wide);
    --tracking-wider: var(--ds-tracking-wider);

    --space-1: var(--ds-space-1);
    --space-2: var(--ds-space-2);
    --space-3: var(--ds-space-3);
    --space-4: var(--ds-space-4);
    --space-5: var(--ds-space-5);
    --space-6: var(--ds-space-6);
    --space-8: var(--ds-space-8);
    --space-10: var(--ds-space-10);
    --space-12: var(--ds-space-12);
    --space-16: var(--ds-space-16);

    --shadow-xs: var(--ds-shadow-xs);
    --shadow-sm: var(--ds-shadow-sm);
    --shadow-md: var(--ds-shadow-md);
    --shadow-lg: var(--ds-shadow-lg);
    --shadow-xl: var(--ds-shadow-xl);
    --shadow-focus: var(--ds-focus-ring);
    --shadow-input: var(--ds-shadow-input);
    --shadow-dropdown: var(--ds-shadow-dropdown);
    --shadow-panel: var(--ds-shadow-panel);

    --transition-fast: var(--ds-transition-fast);
    --transition-base: var(--ds-transition-base);
    --transition-slow: var(--ds-transition-slow);

    --z-base: var(--ds-z-base);
    --z-dropdown: var(--ds-z-dropdown);
    --z-sticky: var(--ds-z-sticky);
    --z-overlay: var(--ds-z-overlay);
    --z-modal: var(--ds-z-modal);
    --z-toast: var(--ds-z-toast);

    --gray-800: 71, 85, 105;   /* rgb triplets for rgba(var(--gray-800), a) in older rules */
    --gray-700: 71, 85, 105;
    /* App chrome (sidebar, top bar) follows the page canvas in both themes. */
    --sidebar-bg: var(--ds-background);
    --sidebar-bottom-bg: var(--ds-background);
    --sidebar-border: var(--ds-border);
    --sidebar-text: var(--ds-text);
    --sidebar-text-hover: var(--ds-text);
    --sidebar-active-text: var(--ds-primary-ink);
    --sidebar-hover-bg: var(--ds-background-muted);
    --sidebar-hover: var(--ds-background-muted);
    --sidebar-active-bg: var(--ds-primary-soft);
    --sidebar-rail-color: var(--ds-border-strong);
    --sidebar-rail-active-color: var(--ds-primary);
    --header-bg: var(--ds-background);
    --header-border: var(--ds-border);
    --header-nav-text: var(--ds-text);
    --header-nav-hover: var(--ds-text);
    --header-nav-active-bg: var(--ds-primary-tint);
    --header-nav-active-text: var(--ds-primary);
    --sidebar-width: var(--ds-sidebar-width);
    --topbar-height: var(--ds-topbar-height);
}

/* Radius: every UI (classic shell and body.ui-daisy) uses the real rounded scale, matching the landing page. */
:root,
html:has(body.ui-daisy) {
    --radius: var(--ds-radius-md);
    --radius-sm: var(--ds-radius-sm);
    --radius-md: var(--ds-radius-md);
    --radius-lg: var(--ds-radius-lg);
    --radius-xl: var(--ds-radius-xl);
    --radius-2xl: var(--ds-radius-2xl);
    --radius-full: var(--ds-radius-full);
}

/* Names that only ever existed in the dark theme. */
:root:root[data-theme="dark"] {
    --bg-subtle: var(--ds-gray-100);
    --border-light: var(--ds-border-subtle);
    --text-dark: var(--ds-text);
    --gray-800: 15, 23, 42;
    --gray-700: 17, 24, 39;
    --sidebar-active-text: var(--ds-text);
    --sidebar-active-bg: var(--ds-primary-tint);
    --sidebar-rail-active-color: var(--ds-primary-soft-border);
}
