/**
 * Design tokens — ИнспектКом Help Center
 * Spec: design-system/MASTER.md (Minimal-first + selective glass)
 */
@font-face {
  font-family: "Lexend";
  src: url("../fonts/lexend-latin-ext-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Lexend";
  src: url("../fonts/lexend-latin-ext-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-cyrillic-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-cyrillic-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Стабильная ширина под вертикальный скролл — без сдвига сайдбара/шапки */
html {
  scrollbar-gutter: stable;
}

:root {
  --font-heading: "Lexend", system-ui, sans-serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;

  --color-background: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-muted: #f1f5f9;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-text: #1e293b;
  --color-text-soft: #334155; /* основной текст статей: темнее muted, читабельнее */
  --color-text-muted: #64748b;
  --color-primary: #475569;
  --color-secondary: #64748b;
  --color-cta: #2563eb;
  --color-cta-hover: #1d4ed8;
  /* Второй акцент — видео/YouTube: приглушённый красный в тон палитры */
  --color-video-accent: #dc2626;
  --color-video-accent-hover: #b91c1c;
  --color-success: #059669;
  --color-danger: #e11d48;
  --color-info-bg: #eff6ff;
  --color-info-border: #bfdbfe;
  --color-info-text: #1e40af;
  --color-focus-ring: #2563eb;
  --color-on-accent: #ffffff;
  --color-video-chrome-bg: #0f172a;

  /* Spacing — project convention (4px base) */
  --space-xs: 0.25rem; /* 4 */
  --space-sm: 0.5rem; /* 8 */
  --space-md: 0.75rem; /* 12 */
  --space-std: 1rem; /* 16 */
  --space-lg: 1.5rem; /* 24 */
  --space-xl: 2rem; /* 32 */
  --space-2xl: 3rem; /* 48 */
  --space-3xl: 4rem; /* 64 */

  /* Radius — project convention (6 / 10 / 14 / 18 px) */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 0.875rem;
  --radius-xl: 1.125rem;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

  /* Typography scale — ratio ~1.125, body 17px (по отзывам: «слишком мелкий шрифт») */
  --text-xs: 0.78125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.75rem;
  --leading-body: 1.55;
  --leading-heading: 1.25;

  /* Elevation (z-index) */
  --z-header: 40;
  --z-overlay: 50;
  --z-drawer: 60;
  --z-modal: 70;
  --z-lightbox: 100;

  /* Card surface (legal tables, etc.) */
  --surface-card-bg: transparent;
  --radius-card: 0.75rem;

  /* Semi-glass header (selective glass policy) */
  --surface-header-bg: color-mix(in srgb, var(--color-surface) 86%, transparent);
  --surface-header-blur: 12px;

  /* Overlay dimmer (blur is decorative; contrast is from alpha) */
  --overlay-backdrop-bg: color-mix(in srgb, var(--color-text) 45%, transparent);
  --overlay-backdrop-blur: 4px;

  --transition-base: 200ms ease;
}

.dark {
  --color-background: #0f172a;
  --color-surface: #1e293b;
  --color-surface-muted: #334155;
  --color-border: #334155;
  --color-border-strong: #475569;
  --color-text: #f1f5f9;
  --color-text-soft: #cbd5e1;
  --color-text-muted: #a3b0c2;
  --color-primary: #94a3b8;
  --color-secondary: #8494a7;
  --color-cta: #3b82f6;
  --color-cta-hover: #60a5fa;
  --color-video-accent: #ef4444;
  --color-video-accent-hover: #f87171;
  --color-success: #34d399;
  --color-danger: #fb7185;
  --color-info-bg: rgba(30, 58, 138, 0.35);
  --color-info-border: #3b82f6;
  --color-info-text: #bfdbfe;
  --color-focus-ring: #60a5fa;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 24px 40px rgba(0, 0, 0, 0.55);

  --surface-header-bg: color-mix(in srgb, var(--color-surface) 82%, transparent);
  --color-video-chrome-bg: #020617;
}

@media (prefers-reduced-transparency: reduce) {
  :root {
    --surface-header-bg: var(--color-surface);
    --surface-header-blur: 0px;
    --overlay-backdrop-bg: color-mix(in srgb, var(--color-text) 58%, transparent);
    --overlay-backdrop-blur: 0px;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  line-height: var(--leading-heading);
}

/* Skip link (keyboard) */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--color-cta);
  color: var(--color-on-accent);
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 1rem;
  outline: 2px solid var(--color-on-accent);
  outline-offset: 2px;
}

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