/* ============================================================
   Полиленд — базовый слой дизайн-системы
   CSS-переменные, reset, типографика
   ============================================================ */

:root {
    /* Фирменные цвета */
    --color-primary: #2B4FED;          /* синий — основной бренд */
    --color-primary-dark: #1E3AB8;
    --color-primary-light: #5B74F0;
    --color-accent: #FF5C39;           /* оранжевый — CTA, акценты */
    --color-accent-dark: #E04420;
    --color-accent-light: #FF7855;

    /* Нейтральные */
    --color-ink: #0F172A;              /* основной текст */
    --color-ink-muted: #475569;        /* вторичный текст */
    --color-ink-soft: #94A3B8;         /* подписи */
    --color-line: #E2E8F0;             /* линии, границы */
    --color-bg: #FFFFFF;
    --color-bg-soft: #F8FAFC;
    --color-bg-muted: #F1F5F9;

    /* Семантика */
    --color-success: #16A34A;
    --color-warning: #EAB308;
    --color-danger: #DC2626;
    --color-info: #0EA5E9;

    /* Типографика */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    /* Размеры шрифтов (fluid typography) */
    --fs-xs: 0.75rem;      /* 12 */
    --fs-sm: 0.875rem;     /* 14 */
    --fs-base: 1rem;       /* 16 */
    --fs-lg: 1.125rem;     /* 18 */
    --fs-xl: 1.25rem;      /* 20 */
    --fs-2xl: clamp(1.375rem, 1.2rem + 0.9vw, 1.75rem);
    --fs-3xl: clamp(1.75rem, 1.45rem + 1.5vw, 2.5rem);
    --fs-4xl: clamp(2.25rem, 1.8rem + 2.25vw, 3.5rem);
    --fs-5xl: clamp(2.75rem, 2rem + 3.75vw, 4.5rem);

    /* Высота строки */
    --lh-tight: 1.15;
    --lh-snug: 1.3;
    --lh-normal: 1.5;
    --lh-relaxed: 1.65;

    /* Жирность */
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --fw-black: 900;

    /* Отступы (8-pt grid) */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;
    --sp-16: 4rem;
    --sp-20: 5rem;
    --sp-24: 6rem;

    /* Скругления */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Тени */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 8px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 20px rgba(15, 23, 42, 0.10), 0 3px 6px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 20px 40px rgba(15, 23, 42, 0.12), 0 8px 16px rgba(15, 23, 42, 0.06);

    /* Переходы */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --dur-fast: 150ms;
    --dur-base: 250ms;
    --dur-slow: 400ms;

    /* Z-индексы */
    --z-base: 1;
    --z-sticky: 100;
    --z-overlay: 500;
    --z-modal: 1000;
    --z-toast: 1500;

    /* Контейнеры */
    --container-max: 1280px;
    --container-narrow: 960px;
    --container-wide: 1440px;
    --container-pad: clamp(1rem, 4vw, 2.5rem);
}

/* ============================================================
   Reset
   ============================================================ */

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

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    color: var(--color-ink);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    min-height: 100dvh;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
}

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

ul, ol {
    list-style: none;
}

table {
    border-collapse: collapse;
    width: 100%;
}

/* ============================================================
   Типографика
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    letter-spacing: -0.02em;
    color: var(--color-ink);
}

h1 { font-size: var(--fs-5xl); font-weight: var(--fw-black); }
h2 { font-size: var(--fs-4xl); }
h3 { font-size: var(--fs-3xl); }
h4 { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); }
h5 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
h6 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }

p {
    line-height: var(--lh-relaxed);
    color: var(--color-ink-muted);
}

strong, b { font-weight: var(--fw-semibold); color: var(--color-ink); }

small { font-size: var(--fs-sm); }

/* ============================================================
   Утилиты
   ============================================================ */

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.visually-hidden { @extend .sr-only; }

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

::selection {
    background: var(--color-primary);
    color: #fff;
}

@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;
    }
}
