/* T-Apuri — Design Tokens + CSS Reset + Base Styles */
/* Session 7.1 */

/* ============================================
   1. DESIGN TOKENS (CSS Custom Properties)
   ============================================ */

:root {
    /* --- Väripaletti: Primääri (sininen) --- */
    --color-primary-50:  #eff6ff;
    --color-primary-100: #dbeafe;
    --color-primary-200: #bfdbfe;
    --color-primary-500: #3b82f6;
    --color-primary-600: #2563eb;
    --color-primary-700: #1d4ed8;
    --color-primary-800: #1e40af;

    /* --- Väripaletti: Neutraali --- */
    --color-neutral-50:  #f8fafc;
    --color-neutral-100: #f1f5f9;
    --color-neutral-200: #e2e8f0;
    --color-neutral-300: #cbd5e1;
    --color-neutral-400: #94a3b8;
    --color-neutral-500: #64748b;
    --color-neutral-600: #475569;
    --color-neutral-700: #334155;
    --color-neutral-800: #1e293b;
    --color-neutral-900: #0f172a;

    /* --- Semanttiset värit --- */
    --color-success: #22c55e;
    --color-error:   #ef4444;
    --color-warning: #f59e0b;
    --color-info:    #3b82f6;

    /* --- Pinta-aliakset (dark mode -valmius) --- */
    --surface-background: var(--color-neutral-50);
    --surface-card:       #ffffff;
    --surface-sidebar:    #ffffff;
    --surface-panel:      #ffffff;

    /* --- Teksti-aliakset --- */
    --text-primary:   var(--color-neutral-800);
    --text-secondary: var(--color-neutral-500);
    --text-muted:     var(--color-neutral-400);
    --text-inverse:   #ffffff;

    /* --- Reunukset --- */
    --border-default: var(--color-neutral-200);
    --border-focus:   var(--color-primary-600);

    /* --- Spacing (4px pohja) --- */
    --space-1:  0.25rem;  /* 4px */
    --space-2:  0.5rem;   /* 8px */
    --space-3:  0.75rem;  /* 12px */
    --space-4:  1rem;     /* 16px */
    --space-5:  1.25rem;  /* 20px */
    --space-6:  1.5rem;   /* 24px */
    --space-8:  2rem;     /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */

    /* --- Typografia --- */
    --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-family-mono: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;

    --font-size-xs:  0.75rem;   /* 12px */
    --font-size-sm:  0.875rem;  /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-lg:  1.125rem;  /* 18px */
    --font-size-xl:  1.25rem;   /* 20px */
    --font-size-2xl: 1.5rem;    /* 24px */
    --font-size-3xl: 1.875rem;  /* 30px */

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

    --line-height-tight:   1.25;
    --line-height-normal:  1.5;
    --line-height-relaxed: 1.75;

    /* --- Layout-mitat --- */
    --sidebar-width:           240px;
    --sidebar-width-collapsed: 60px;
    --context-panel-width:     420px;
    --header-height:           56px;

    /* --- Reunapyöristykset --- */
    --border-radius-sm: 0.25rem;  /* 4px */
    --border-radius-md: 0.375rem; /* 6px */
    --border-radius-lg: 0.5rem;   /* 8px */

    /* --- Varjot --- */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* --- Transitiot --- */
    --transition-fast:   150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow:   300ms ease;
}

/* ============================================
   2. CSS RESET
   ============================================ */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* hidden-attribuutin varmistus */
[hidden] {
    display: none !important;
}

/* ============================================
   3. BASE STYLES
   ============================================ */

html {
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background-color: var(--surface-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    min-height: 100dvh;
}

img, svg {
    display: block;
    max-width: 100%;
}

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ============================================
   4. REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
