/* Track and Grow · shared tokens and base styles.
   Theme-independent: the same in light and dark. Colours live in light.css / dark.css. */
:root {
    /* ── Fonts (self-hosted, see fonts.css) ──────────────────────── */
    --font-sans:    "Atkinson Hyperlegible Next", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-display: Manrope, "Atkinson Hyperlegible Next", system-ui, sans-serif;
    --font-mono:    "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

    /* ── Type scale ──────────────────────────────────────────────── */
    --font-size-xs:  0.75rem;    /* 12px · captions, badges */
    --font-size-sm:  0.875rem;   /* 14px · secondary text */
    --font-size-md:  1rem;       /* 16px · body */
    --font-size-lg:  1.125rem;   /* 18px · lead text */
    --font-size-xl:  1.25rem;    /* 20px · h4 */
    --font-size-2xl: 1.5rem;     /* 24px · h3 */
    --font-size-3xl: 1.875rem;   /* 30px · h2 */
    --font-size-4xl: 2.25rem;    /* 36px · h1 */

    --font-weight-regular:  400;
    --font-weight-medium:   500;
    --font-weight-semibold: 600;
    --font-weight-bold:     700;

    --line-height-tight: 1.2;    /* headings */
    --line-height-body:  1.5;    /* running text */

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

    /* ── Radii ───────────────────────────────────────────────────── */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* ── Motion ──────────────────────────────────────────────────── */
    --duration-instant:   80ms;
    --duration-fast:      140ms;
    --duration-base:      220ms;
    --duration-slow:      320ms;
    --duration-celebrate: 640ms;
    --ease-standard: cubic-bezier(0.2, 0, 0, 1);
    --ease-exit:     cubic-bezier(0.4, 0, 1, 1);
    --ease-leap:     cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ── Controls and focus ──────────────────────────────────────── */
    --control-sm: 36px;
    --control-md: 44px;
    --control-lg: 52px;
    --touch-min:  44px;
    --focus-width:  2px;
    --focus-offset: 2px;

    /* ── Layout ──────────────────────────────────────────────────── */
    --sidebar-width: 256px;
    --topbar-height: 64px;
    --tabbar-height: 64px;
    --content-max:   1200px;
    --sheet-width:   480px;

    /* ── Stacking ────────────────────────────────────────────────── */
    --z-sticky:  10;
    --z-nav:     20;
    --z-popover: 40;
    --z-sheet:   50;
    --z-toast:   60;
}

/* ── Base ─────────────────────────────────────────────────────── */
html, body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    min-height: 100dvh;
    background-color: var(--canvas);
    font-family: var(--font-sans);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-body);
    color: var(--text);
}
/* Padding and borders count inside width and height, in every component too */
*, *::before, *::after {
    box-sizing: border-box;
}


h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--text-strong);
    margin: 0 0 var(--space-4);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

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

/* ── Layout ───────────────────────────────────────────────────── */
.page {
    display: block;
    background-color: var(--canvas);
}

.container {
    padding: var(--space-6);
    padding-bottom: var(--space-12);
    max-width: var(--content-max);
    margin: 0 auto;
}

.card {
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--elevation-1);
    margin-bottom: var(--space-6);
}

.text-wrap {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* ── Utilities ────────────────────────────────────────────────── */
.muted {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-4);
}

.error {
    color: var(--danger);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-2);
    min-height: 1.2em;
}

.empty {
    color: var(--text-muted);
    font-style: italic;
}

.nav-actions {
    margin-top: var(--space-4);
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}
