/*
 * Design tokens — единый источник правды для платформы ООО «СИСТЕМА» (Phase 1).
 *
 * Стратегия: три параллельных preset-палитры под визуальное сравнение
 * через <body data-palette="mono|brand|warm">. После решения по brand —
 * лишние удаляются, остаётся одна.
 *
 * Подключение:
 *   - Vite/Inertia: первой строкой в resources/css/app.css → @import './tokens.css';
 *   - Blade landing: ВКЛЮЧАЕТСЯ ВРУЧНУЮ в layouts/app.blade.php (link rel="stylesheet")
 */

:root {
    /* === Spacing — 4px baseline (общее для всех палитр) === */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;
    --s-8: 64px;
    --s-9: 96px;
    --s-10: 128px;
    --s-11: 192px;

    /* === Radii === */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* === Container widths === */
    --w-landing: 1280px;
    --w-cabinet: 1440px;
    --w-content-rail: 1120px;
    --w-sidebar: 240px;
    --w-sidebar-collapsed: 64px;

    /* === Motion === */
    --duration-fast: 120ms;
    --duration-base: 200ms;
    --duration-slow: 400ms;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

    /* === Z-index scale === */
    --z-sticky: 10;
    --z-overlay: 50;
    --z-modal: 100;
    --z-toast: 200;
    --z-cmdk: 300;

    /* === Shadows (multi-layer для soft depth) === */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 4px 12px rgba(15, 23, 42, 0.05);
    --shadow-lg:
        0 2px 4px rgba(15, 23, 42, 0.05),
        0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-focus-ring: 0 0 0 3px var(--accent-soft);
}

/*
 * ============================================================================
 * Brand palette — финализирована (Phase 1 → Phase 2).
 * #131B5C индиго как accent, #059669 изумруд как success-семантика.
 * Сохраняет узнаваемость бренда в новом editorial layout.
 * ============================================================================
 */
:root {
    --foundation: #f8fafc;
    --surface: #ffffff;
    --surface-sunken: #f1f5f9;

    --ink: #0f172a;
    --ink-muted: #475569;
    --ink-subtle: #64748b;

    --hairline: #e2e8f0;
    --hairline-strong: #cbd5e1;

    --accent: #131b5c;
    --accent-soft: #dbeafe;
    --accent-strong: #0c1144;

    --brand-anchor: #131b5c;

    --success: #059669;
    --success-soft: #d1fae5;
    --success-strong: #065f46;
    --warning: #f59e0b;
    --warning-soft: #fef3c7;
    --warning-strong: #92400e;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --danger-strong: #991b1b;
    --info: #3b82f6;
    --info-soft: #dbeafe;
    --info-strong: #1e40af;
}

/*
 * ============================================================================
 * Role-aware accents для кабинетов (применяется ПОВЕРХ palette через
 * <body data-role="...">). Позволяет каждому кабинету иметь свой оттенок.
 * ============================================================================
 */
[data-role='investor'] { --accent-role: var(--accent); }
[data-role='borrower'] { --accent-role: #22d3ee; }
[data-role='operator'] { --accent-role: #a855f7; }
[data-role='aml_officer'] { --accent-role: #f59e0b; }
[data-role='auditor'] { --accent-role: #64748b; }
[data-role='regulator'] { --accent-role: var(--brand-anchor); }
[data-role='admin'] { --accent-role: #f43f5e; }

/*
 * ============================================================================
 * Typography — общее для всех палитр.
 * Display: Unbounded (наследие) — решение о смене на Editorial New / Fraunces
 * принимается после прототипа.
 * Body: Inter (новый, добавляется параллельно к Onest как fallback).
 * Mono: JetBrains Mono (наследие).
 * ============================================================================
 */
:root {
    --font-display: 'Unbounded', 'Inter Display', system-ui, sans-serif;
    --font-body: 'Inter', 'Onest', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    /* Size tokens (rem, base 16px) */
    --t-display: clamp(2.75rem, 6vw, 5.5rem);     /* hero лендинга 44-88px */
    --t-h1: clamp(2rem, 4vw, 3.25rem);            /* section title 32-52px */
    --t-h1-cab: 1.75rem;                          /* page title кабинета 28px */
    --t-h2: clamp(1.5rem, 2.5vw, 2rem);           /* 24-32px */
    --t-h3: 1.125rem;                             /* 18px */
    --t-body-lg: 1.25rem;                         /* 20px — hero lead */
    --t-body: 1rem;                               /* 16px */
    --t-small: 0.8125rem;                         /* 13px */
    --t-xs: 0.75rem;                              /* 12px */
    --t-overline: 0.75rem;                        /* 12px uppercase + LS */
    --t-mono: 0.8125rem;

    /* Line heights */
    --lh-display: 0.95;
    --lh-tight: 1.05;
    --lh-snug: 1.2;
    --lh-body: 1.6;

    /* Letter spacing */
    --ls-display: -0.04em;
    --ls-h1: -0.03em;
    --ls-h2: -0.02em;
    --ls-overline: 0.14em;
}

/*
 * ============================================================================
 * Base resets — минимум.
 * ============================================================================
 */

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    background-color: var(--foundation);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--t-body);
    line-height: var(--lh-body);
    font-feature-settings: 'ss01', 'cv11';
}

::selection {
    background-color: var(--accent-soft);
    color: var(--ink);
}

/* Tabular nums везде где money/percent (применяется через utility) */
.tabular-nums {
    font-variant-numeric: tabular-nums lining-nums;
}

/* Honour reduced-motion на любых transitions/animations */
@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;
    }
}
