/* T-Apuri — Design Tokens + CSS Reset + Base Styles */
/* Session 7.1 · A6a (S146, 9.9.2026): Avustar-ilme — tokenit avustar-web/styles.css:stä */

/* Self-hostattu Montserrat (display-fontti; K3 hybridi). Polku /assets-mountista
   (src/api/app.py), ei Google Fonts. swap: teksti näkyy heti system-fontilla. */
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/assets/fonts/montserrat-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

:root {
    /* --- Brändi (Avustar; lähde avustar-web/styles.css :root) --- */
    --ink:           #0f1b2d;  /* syvä navy — primääri */
    --ink-soft:      #33415c;
    --muted:         #5b6b85;
    --line:          #e5e9f2;
    --bg-alt:        #f5f7fc;
    --accent:        #c07a1e;  /* meripihka — vain pinnat/korostukset */
    --accent-strong: #a4661a;  /* amber-TEKSTI aina tällä (AA 4,7:1; --accent 3,5:1 ei riitä) */
    --accent-tint:   #fbf2e4;

    /* --- Väripaletti: Primääri (navy; K2 = A) ---
       Brändivaihto tapahtuu kokonaan näistä tokeneista — components.css:n
       hexit ovat tilavärejä (K5), graph.css:n solmuvärit semanttisia. */
    --color-primary-50:  var(--bg-alt);
    --color-primary-100: var(--accent-tint);
    --color-primary-200: #dbe1ee;
    --color-primary-300: #b7c2d6;
    --color-primary-400: #7f8ea8;
    --color-primary-500: var(--muted);
    --color-primary-600: var(--ink);
    --color-primary-700: var(--ink-soft);
    --color-primary-800: #0b1422;
    --color-primary-900: #070d18;

    /* --- 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 (K3 hybridi: display otsikoille/brändille/naville, base datalle) --- */
    --font-family-display: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --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 */
    --border-radius-xl: 0.75rem;  /* 12px — kortit/viestit (K4) */
    --border-radius-2xl: 1rem;    /* 16px — vain login-kortti (K4) */

    /* --- 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);
    --shadow-brand: 0 1px 2px rgba(15, 27, 45, 0.04), 0 10px 30px rgba(15, 27, 45, 0.06); /* kotisivun korttivarjo */

    /* --- 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;
    }
}
