/* Design tokens (design pass DP-02, apple-design skill). Components use only these variables, so swapping the file
   restyles the app. The skill names its tokens --pos-*; the equivalents here:
     --pos-canvas  -> --canvas        --pos-surface -> --surface       --pos-line     -> --line
     --pos-shadow-* -> --shadow-1..3  (small chips and menus, popovers and toasts, modals and side panels)
   Colour is never animated on large areas, only transform and opacity (skill section 0.4). */
:root {
    /* Type: system font first (it ships optical sizing). Tracking tightens as the size grows, leading loosens as it shrinks. */
    --font-sans: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.875rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --tracking-display: -0.02em;
    --tracking-title: -0.01em;
    --tracking-body: 0;
    --tracking-small: 0.01em;
    --leading-display: 1.15;
    --leading-title: 1.3;
    --leading-body: 1.5;
    --leading-dense: 1.35;

    /* Surfaces: canvas < sidebar < surface; sunken wells sit below the surface. */
    --canvas: #f6f5f3;
    --sidebar: #15161a;
    --surface: #ffffff;
    --surface-sunken: #f0eeeb;
    --line: rgba(28, 25, 22, 0.09);
    --line-strong: rgba(28, 25, 22, 0.2);
    --line-control: #858e9a; /* the edge of an input: 3:1 against white (WCAG 1.4.11) */

    --color-text: #1c1a17;
    --color-text-muted: #5f5b55;
    --color-primary: #cf4308;
    --color-primary-hover: #b13a06;
    --color-on-primary: #ffffff;
    --color-danger: #b42318;
    --color-danger-bg: #fdecea;
    --color-success: #1a7f37;
    --color-success-bg: #e8f5ec;
    --color-warning: #8a5b00;
    --color-warning-bg: #fff4d6;
    --color-focus: #e8590c;
    --color-overlay: rgba(15, 23, 42, 0.4);
    --color-selected: color-mix(in srgb, var(--color-primary) 12%, var(--surface));

    /* Orange accent: --color-primary carries white text at 4.7:1; --accent is the bright tone for glows, icons on the
       dark sidebar and focus, never for small text on white. */
    --accent: #ff7a1a;
    --accent-soft: color-mix(in srgb, var(--color-primary) 9%, var(--surface));
    --ink: #15161a;
    --nav-text: #a3a7b0;
    --nav-text-strong: #f4f5f7;
    --nav-hover: rgba(255, 255, 255, 0.06);
    --nav-active: rgba(255, 122, 26, 0.16);
    --nav-line: rgba(255, 255, 255, 0.08);
    --nav-text-dim: #6c717b;
    --nav-text-label: #7d828c;
    --nav-scrollbar: rgba(255, 255, 255, 0.18);
    --edge-light: rgba(255, 255, 255, 0.22);
    --primary-shadow: rgba(177, 58, 6, 0.4);
    --brand-glow: rgba(242, 106, 20, 0.35);

    /* Spacing in rem so layout follows the user's text size. */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    /* Bigger surfaces read as thicker: a deeper shadow, not more blur. */
    --shadow-1: 0 1px 2px rgba(28, 25, 22, 0.06), 0 1px 1px rgba(28, 25, 22, 0.04);
    --shadow-2: 0 6px 18px rgba(28, 25, 22, 0.1), 0 1px 3px rgba(28, 25, 22, 0.06);
    --shadow-3: 0 24px 60px rgba(28, 25, 22, 0.26), 0 4px 12px rgba(28, 25, 22, 0.1);

    /* Motion: transform and opacity only, 300 ms at most, triggered by an action. */
    --press-duration: 100ms;
    --enter-duration: 200ms;
    --ease-enter: cubic-bezier(0.2, 0.8, 0.2, 1);
    --ease-exit: cubic-bezier(0.8, 0.2, 1, 0.2);
    --press-scale: 0.97;
    --anim-enter: enter-pop var(--enter-duration) var(--ease-enter) both;
    --anim-enter-fade: enter-fade var(--enter-duration) linear both;
    --anim-enter-left: enter-from-left var(--enter-duration) var(--ease-enter) both;
    --anim-enter-right: enter-from-right var(--enter-duration) var(--ease-enter) both;

    --header-height: 3.5rem;
    --sidebar-width: 15.5rem;
    --hit-min: 2.75rem;
    --z-sticky: 10;
    --z-menu: 20;
    --z-overlay: 1000;
    --z-toast: 1100;
}

@keyframes enter-pop {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes enter-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes enter-from-left {
    from {
        opacity: 0;
        transform: translateX(-1.5rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes enter-from-right {
    from {
        opacity: 0;
        transform: translateX(1.5rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Reduced motion keeps feedback but drops slides and scaling: arrivals become short cross-fades. */
@media (prefers-reduced-motion: reduce) {
    :root {
        --anim-enter: var(--anim-enter-fade);
        --anim-enter-left: var(--anim-enter-fade);
        --anim-enter-right: var(--anim-enter-fade);
        --enter-duration: 120ms;
        --press-scale: 1;
    }
}

/* More contrast: edges become visible. Every surface here is already solid (no blur or translucency), so
   prefers-reduced-transparency needs nothing; the only translucent layer is the modal scrim, which stays. */
@media (prefers-contrast: more) {
    :root {
        --line: rgba(15, 23, 42, 0.5);
        --line-control: #4b535d;
        --line-strong: rgba(15, 23, 42, 0.75);
        --color-text-muted: #3a424c;
        --color-overlay: rgba(15, 23, 42, 0.6);
    }
}
