/* ═══════════════════════════════════════════════════════════════════════
   crashgames.guide — Electric Sky design system
   main.css — reset + tokens + typography + layout

   Файл служебный. Изменения визуала должны идти через CSS custom
   properties ниже (секция :root).
   ═══════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────
   1. DESIGN TOKENS
   ───────────────────────────────────────────────────────────────────── */
:root {
    /* Colors — Electric Sky */
    --bg:              #F5F9FF;
    --bg-alt:          #EEF4FC;
    --surface:         #FFFFFF;
    --surface-elev:    #FBFDFF;

    --primary:         #4F46E5;   /* indigo — CTA, links */
    --primary-dark:    #4338CA;
    --primary-light:   #818CF8;
    --primary-50:      #EEF2FF;

    --accent:          #06B6D4;   /* cyan — highlights */
    --accent-dark:     #0891B2;
    --accent-light:    #67E8F9;
    --accent-50:       #ECFEFF;

    --success:         #10B981;   /* emerald — multiplier growth */
    --success-50:      #ECFDF5;

    --alert:           #F97316;   /* orange — crash / warnings */
    --alert-50:        #FFF7ED;

    --danger:          #EF4444;
    --info:            #3B82F6;

    --text:            #0F172A;
    --text-muted:      #64748B;
    --text-dim:        #94A3B8;

    --border:          #E2E8F0;
    --border-strong:   #CBD5E1;
    --border-subtle:   #F1F5F9;

    /* Gradients */
    --grad-primary:    linear-gradient(135deg, #4F46E5 0%, #06B6D4 100%);
    --grad-growth:     linear-gradient(90deg, #10B981 0%, #06B6D4 100%);
    --grad-crash:      linear-gradient(135deg, #F97316 0%, #EF4444 100%);
    --grad-bg-hero:    linear-gradient(180deg, #EEF4FC 0%, #F5F9FF 100%);

    /* Shadow tokens */
    --shadow-xs:       0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm:       0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md:       0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg:       0 12px 32px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
    --shadow-xl:       0 24px 48px rgba(15, 23, 42, 0.12);
    --shadow-glow:     0 0 0 4px rgba(79, 70, 229, 0.12);

    /* Radii */
    --r-xs:            4px;
    --r-sm:            6px;
    --r-md:            10px;
    --r-lg:            14px;
    --r-xl:            20px;
    --r-2xl:           28px;
    --r-full:          999px;

    /* Spacing scale */
    --sp-1:            4px;
    --sp-2:            8px;
    --sp-3:            12px;
    --sp-4:            16px;
    --sp-5:            20px;
    --sp-6:            24px;
    --sp-8:            32px;
    --sp-10:           40px;
    --sp-12:           48px;
    --sp-16:           64px;
    --sp-20:           80px;
    --sp-24:           96px;

    /* Typography */
    --font-sans:       'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono:       'Geist Mono', 'SF Mono', Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

    --fs-xs:           0.75rem;
    --fs-sm:           0.875rem;
    --fs-base:         1rem;
    --fs-md:           1.0625rem;
    --fs-lg:           1.25rem;
    --fs-xl:           1.5rem;
    --fs-2xl:          1.875rem;
    --fs-3xl:          2.25rem;
    --fs-4xl:          3rem;
    --fs-5xl:          3.75rem;

    --lh-tight:        1.15;
    --lh-snug:         1.3;
    --lh-normal:       1.55;
    --lh-relaxed:      1.7;

    --fw-regular:      400;
    --fw-medium:       500;
    --fw-semibold:     600;
    --fw-bold:         700;
    --fw-black:        800;

    /* Layout */
    --container-max:   1200px;
    --container-pad:   24px;
    --header-h:        80px;
    --header-h-mobile: 120px; /* two-tier: logo row + CTA row */

    /* Transitions */
    --t-fast:          120ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-base:          200ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow:          320ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-index scale */
    --z-header:        100;
    --z-drawer:        200;
    --z-modal:         400;
    --z-toast:         500;
    --z-tooltip:       600;
}

/* ─────────────────────────────────────────────────────────────────────
   2. RESET
   ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: -0.02em; }
p { margin: 0 0 var(--sp-4) 0; }
p:last-child { margin-bottom: 0; }
a { color: var(--primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--primary-dark); }
img, svg, video { display: block; max-width: 100%; height: auto; }
ul, ol { margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; padding: 0; }
input, textarea, select { font-family: inherit; font-size: inherit; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-8) 0; }
code, kbd, samp, pre { font-family: var(--font-mono); }

/* Skip link for accessibility */
.skip-link {
    position: absolute; top: -100px; left: var(--sp-4);
    background: var(--primary); color: #FFFFFF;
    padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm);
    z-index: var(--z-tooltip);
    transition: top var(--t-fast);
}
.skip-link:focus { top: var(--sp-2); }

/* ─────────────────────────────────────────────────────────────────────
   3. TYPOGRAPHY
   ───────────────────────────────────────────────────────────────────── */
/* Заголовки: mobile-first через clamp(), адаптация под ширину viewport.
   min = мобильный размер, preferred = scales with vw, max = desktop размер. */
.h1, h1.page-title { font-size: clamp(1.75rem, 3.8vw + 0.9rem, 3rem); line-height: var(--lh-tight); }
.h2, h2 { font-size: clamp(1.375rem, 2.6vw + 0.8rem, 2.25rem); line-height: var(--lh-tight); }
.h3, h3 { font-size: clamp(1.125rem, 1.4vw + 0.8rem, 1.875rem); line-height: var(--lh-snug); }
.h4, h4 { font-size: clamp(1rem,    1vw + 0.8rem, 1.5rem); }
.h5, h5 { font-size: var(--fs-lg); }
.h6, h6 { font-size: var(--fs-md); }

.text-xs    { font-size: var(--fs-xs); }
.text-sm    { font-size: var(--fs-sm); }
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-mono  { font-family: var(--font-mono); }
.text-center{ text-align: center; }

/* ─────────────────────────────────────────────────────────────────────
   4. LAYOUT UTILITIES
   Правило проекта: max-width ТОЛЬКО на .container. Ни на параграфах,
   ни на заголовках, ни на текстах секций.
   ───────────────────────────────────────────────────────────────────── */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-pad);
}
.container-narrow {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 var(--container-pad);
}

/* Section vertical rhythm: mobile-first, уменьшено на ~30% vs старых sp-16/sp-10/sp-24.
   На mobile ещё компактнее; на desktop увеличивается через min-width query. */
:root {
    --section-y:       32px;  /* default mobile */
    --section-y-tight: 20px;
    --section-y-lg:    48px;
    --section-head-mb: 24px;
}
@media (min-width: 768px) {
    :root {
        --section-y:       44px;
        --section-y-tight: 28px;
        --section-y-lg:    68px;
        --section-head-mb: 32px;
    }
}
.section       { padding: var(--section-y) 0; }
.section-tight { padding: var(--section-y-tight) 0; }
.section-lg    { padding: var(--section-y-lg) 0; }

.section-head  { margin-bottom: var(--section-head-mb); }
.section-head__title    { font-size: clamp(1.375rem, 2.6vw + 0.8rem, 2.25rem); margin: 0 0 var(--sp-3) 0; line-height: var(--lh-tight); }
.section-head__subtitle { color: var(--text-muted); font-size: var(--fs-md); }

/* Stack utility */
.stack > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-8); }

/* Flex / grid quick */
.flex       { display: flex; }
.flex-wrap  { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }

/* Grid helpers */
.grid { display: grid; gap: var(--sp-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Page main area */
.main {
    min-height: calc(100vh - var(--header-h) - 300px);
    padding-top: var(--sp-8);
}

/* ─────────────────────────────────────────────────────────────────────
   5. ANIMATIONS
   ───────────────────────────────────────────────────────────────────── */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.6; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes shimmer {
    0%   { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}
.fade-in { animation: fade-in var(--t-slow) ease both; }
.pulse   { animation: pulse 2s ease-in-out infinite; }

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

/* ─────────────────────────────────────────────────────────────────────
   6. FOCUS / ACCESSIBILITY
   ───────────────────────────────────────────────────────────────────── */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

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