﻿/* ==========================================
   IT-IMPULSE — Elevated Classic design system
   Outfit (display) + Manrope (body) + JetBrains Mono (technical)
   Dark base #0a0a0f · accent #e63946 · status #4ade80
   DJANGO: static/css/style.css
   ========================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Canvas — осветлённая премиальная база */
  --bg-primary: #15151f;
  --bg-card: #1c1c28;
  --bg-card-2: #181822;
  --bg-elevated: #232333;

  /* Lines — увеличены, чтобы оставаться видимыми на новом фоне */
  --border: #2a2a3a;
  --border-strong: #3a3a4f;
  --grid-line: #1f1f2c;

  /* Accent (red) */
  --accent: #e63946;
  --accent-hover: #ff4d5a;
  --accent-dim: #c1121f;
  --accent-ink: #1a0b0f;              /* accent-tinted dark fill */
  --accent-glow: rgba(230, 57, 70, 0.15);
  --accent-glow-strong: rgba(230, 57, 70, 0.35);

  /* Text */
  --text-primary: #f0f0f0;
  --text-secondary: #b0b0be;
  --text-muted: #7a7a8a;

  /* Semantic */
  --success: #4ade80;
  --success-glow: rgba(74, 222, 128, 0.4);

  /* Spacing (8px base) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --space-8: 64px;
  --space-10: 80px;
  --space-12: 96px;
  --space-16: 128px;

  /* Type */
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-base: 16px;
  --fs-md: 18px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 32px;
  --fs-3xl: 44px;
  --fs-4xl: 56px;
  --fs-5xl: 76px;

  /* Layout */
  --container-max: 1280px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Motion */
  --t-fast: 150ms ease;
  --t-base: 250ms cubic-bezier(.2,.7,.3,1);
  --t-slow: 420ms cubic-bezier(.2,.7,.3,1);
}

/* ==========================================
   LIGHT THEME OVERRIDES
   Активируется через <html data-theme="light">.
   Цветовая семантика сохраняется — меняются только сами цвета.
   ========================================== */
[data-theme="light"] {
  --bg-primary: #f7f7f9;
  --bg-card: #ffffff;
  --bg-card-2: #f1f1f5;
  --bg-elevated: #ffffff;

  --border: #e4e4eb;
  --border-strong: #c8c8d2;
  --grid-line: #e8e8ee;

  --accent-ink: #fff4f5;
  --accent-glow: rgba(230, 57, 70, 0.10);
  --accent-glow-strong: rgba(230, 57, 70, 0.22);

  --text-primary: #0a0a0f;
  --text-secondary: #3f3f4a;
  --text-muted: #666674;

  /* Тени (видны только на светлом) */
  --shadow-sm: 0 1px 2px rgba(10, 10, 15, 0.04);
  --shadow-md: 0 4px 20px rgba(10, 10, 15, 0.06);
  --shadow-lg: 0 12px 40px rgba(10, 10, 15, 0.10);

  color-scheme: light;
}

:root { color-scheme: dark; --shadow-sm: none; --shadow-md: none; --shadow-lg: none; }

/* Плавный переход при смене темы */
html,
body,
.card,
.header,
.footer,
.btn,
.nav-links a,
.support-pkg {
  transition: background-color var(--t-base), border-color var(--t-base), color var(--t-base);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  font-feature-settings: "ss01", "cv01";
}
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}
p { margin: 0 0 var(--space-2); color: var(--text-secondary); }
a { color: inherit; text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
::selection { background: var(--accent); color: #fff; }

/* ---------- Type scale ---------- */
h1 { font-size: var(--fs-5xl); letter-spacing: -0.035em; font-weight: 800; }
h2 { font-size: var(--fs-3xl); letter-spacing: -0.03em; font-weight: 800; }
h3 { font-size: var(--fs-xl); letter-spacing: -0.02em; font-weight: 700; }
h4 { font-size: var(--fs-md); letter-spacing: -0.015em; font-weight: 700; }
h5 { font-size: var(--fs-base); font-weight: 700; letter-spacing: -0.01em; }
@media (max-width: 1023px) { h1 { font-size: var(--fs-4xl); }}
@media (max-width: 767px) {
  h1 { font-size: var(--fs-2xl); letter-spacing: -0.025em; }
  h2 { font-size: var(--fs-xl); }
  h3 { font-size: var(--fs-lg); }}

/* ---------- Layout ---------- */
.container { max-width: var(--container-max); margin: 0 auto; padding: 0 var(--space-4); }
.section { padding: var(--space-12) 0; position: relative; }
.section--tight { padding: var(--space-8) 0; }
@media (max-width: 767px) {
  .container { padding: 0 var(--space-3); }
  .section { padding: var(--space-8) 0; }}

/* Контент поверх фона. Поднимаем ТОЛЬКО смысловой контент (main, footer),
   а не «все подряд» — иначе position:relative форсился на fixed-оверлеях и
   фонах (cyber-grid-floor, scroll-progress, mobile-menu, neon-ribbons,
   chapter-nav, page-transition), ломая их fixed-позицию: декоративный
   3D-«пол» уходил в поток и тянул документ далеко под футер («пустота»).
   header не трогаем — у него собственный z-index:100 (для дропдауна «Услуги»). */
body > main, body > footer { position: relative; z-index: 1; }

/* Декоративные absolute-элементы (hero::before, глоу-пятна) не должны
   создавать горизонтальный скролл на узких экранах.

   clip, а не hidden: hidden по одной оси заставляет вторую вычислиться в auto,
   body становится скролл-контейнером, который сам никуда не прокручивается,
   и любой position:sticky внутри страницы перестаёт прилипать. clip режет
   так же, но контейнер не создаёт. */
html, body { overflow-x: clip; }

/* ==========================================

/* ========== ARTICLE + A11Y (legacy marketing chrome removed) ========== */
.article-content {
  width: min(78%, 1000px);
  margin: 0 auto;
  padding: var(--space-10) 0 var(--space-8);
  font-size: 17px;
  line-height: 1.75;
  box-sizing: border-box;
  /* Для плавающих дочерних элементов — контекст для float */
  overflow: visible;
}
.article-content::after { content: ''; display: block; clear: both; }
@media (max-width: 1280px) { .article-content { width: 82%; }}
@media (max-width: 960px)  { .article-content { width: 88%; padding: var(--space-8) 0 var(--space-6); }}
@media (max-width: 640px)  { .article-content { width: 100%; padding: var(--space-6) var(--space-3); font-size: 16px; }}

.article-content h2 {
  margin-top: var(--space-10);
  margin-bottom: var(--space-3);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  position: relative;
  padding-left: 22px;
  color: var(--text-primary);
  clear: both;
}
.article-content h2::before {
  content: '';
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
}
/* Первый h2 после интро — поменьше верхний отступ */
.article-content .article-intro + h2,
.article-content > h2:first-child {
  margin-top: var(--space-6);
}
@media (max-width: 640px) {
  .article-content h2 { font-size: 26px; padding-left: 16px; margin-top: var(--space-8); }}

.article-content h3 {
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  line-height: 1.3;
}
.article-content h2 + h3 { margin-top: var(--space-3); }

.article-content p {
  color: var(--text-primary);
  margin: 0 0 var(--space-3);
}

.article-content ul,
.article-content ol {
  color: var(--text-primary);
  padding-left: var(--space-4);
  margin: 0 0 var(--space-4);
}
.article-content li {
  margin-bottom: 12px;
  padding-left: 6px;
}
.article-content li:last-child { margin-bottom: 0; }
.article-content ul li::marker  { color: var(--accent); }
.article-content ol li::marker  { color: var(--accent); font-weight: 700; font-family: var(--font-mono); }
.article-content a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.article-content a:hover { color: var(--accent-hover); }
/* Кнопки внутри article-content — не перекрашиваем текст в red.
   Без этого правила .article-content a (специфичность 0,2,0) выигрывает у
   .btn-primary (0,1,0) и делает текст красной кнопки красным = невидимым. */
.article-content a.btn-primary,
.article-content a.btn-primary:hover { color: #fff; }
.article-content a.btn-secondary,
.article-content a.btn-secondary:hover { color: var(--text-primary); }
.article-content strong { color: var(--text-primary); font-weight: 700; }

/* Lead paragraph — крупнее, воздушнее, с аккуратной разделительной линией */
.article-intro {
  font-size: 20px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  font-weight: 400;
  letter-spacing: -0.005em;
}
@media (max-width: 640px) { .article-intro { font-size: 17px; }}

/* Pull quote — широкая, выразительная карточка с маркером */
.article-pullquote {
  position: relative;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.42;
  font-weight: 600;
  color: var(--text-primary);
  margin: var(--space-8) 0;
  padding: var(--space-5) var(--space-6) var(--space-5) calc(var(--space-6) + 6px);
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  letter-spacing: -0.015em;
  clear: both;
}
.article-pullquote::before {
  content: '// QUOTE';
  position: absolute;
  top: var(--space-2);
  right: var(--space-3);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.15em;
  font-weight: 500;
  font-style: normal;
  opacity: 0.8;
}
@media (max-width: 640px) {
  .article-pullquote { padding: var(--space-4); margin: var(--space-6) 0; }}

/* Info sidebar — больше воздуха, выравнивание по baseline заголовка */
.article-sidebar {
  margin: var(--space-5) 0;
  padding: var(--space-4) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  clear: both;
}
.article-sidebar h4 {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 var(--space-2);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.article-sidebar p,
.article-sidebar ul {
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 var(--space-2);
}
.article-sidebar ul { padding-left: var(--space-3); }
.article-sidebar li { margin-bottom: 6px; }
.article-sidebar p:last-child,
.article-sidebar ul:last-child { margin-bottom: 0; }

/* Stats — широкая grid-карточка, расположена на всю ширину колонки */
.article-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  margin: var(--space-6) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card-2);
  clear: both;
}
.article-stat {
  padding: var(--space-4) var(--space-3);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.article-stat:last-child { border-right: none; }
/* Убираем border-bottom у последнего ряда при auto-fit wrap */
.article-stat-value {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 10px;
  letter-spacing: -0.03em;
}
.article-stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
@media (max-width: 640px) {
  .article-stat-value { font-size: 34px; }}

/* SVG illustration frame */
.article-illustration {
  margin: var(--space-6) 0;
  clear: both;
}
.article-illustration-frame {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  overflow: hidden;
}
.article-illustration svg { width: 100%; height: auto; display: block; }
.article-caption {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.02em;
}

/* Two-column comparison */
.article-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  clear: both;
}
.article-two-col > div {
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.article-two-col h4 {
  color: var(--accent);
  margin: 0 0 var(--space-2);
  font-size: var(--fs-base);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.article-two-col p,
.article-two-col ul {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 var(--space-2);
}
.article-two-col p:last-child,
.article-two-col ul:last-child { margin-bottom: 0; }
.article-two-col ul { padding-left: var(--space-3); }
.article-two-col li { margin-bottom: 6px; }
@media (max-width: 767px) { .article-two-col { grid-template-columns: 1fr; }}

.article-tag-inline {
  display: inline-block;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  background: rgba(230,57,70,0.1);
  color: var(--accent);
  border: 1px solid rgba(230,57,70,0.3);
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
  vertical-align: middle;
}

/* CTA block — финальная карточка статьи, крупная и сбалансированная */
.article-cta-block {
  margin-top: var(--space-10);
  padding: var(--space-6) var(--space-5);
  background: linear-gradient(180deg, var(--bg-card), #14080d);
  border: 1px solid rgba(230, 57, 70, 0.25);
  border-radius: var(--radius-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
  clear: both;
}
.article-cta-block::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(230, 57, 70, 0.18), transparent 60%);
  pointer-events: none;
}
.article-cta-block > * { position: relative; }
.article-cta-block .section-eyebrow { margin-bottom: var(--space-2); }
.article-cta-block h3 {
  margin: 0 0 var(--space-2);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.article-cta-block p {
  color: var(--text-secondary);
  font-size: var(--fs-md);
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto var(--space-4);
}
.article-cta-block .btn { margin-top: var(--space-1); }

/* Accent inline link */
.link-accent {
  position: relative;
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
}
.link-accent::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--t-base);
}
.link-accent:hover::after { transform: scaleX(1); }

/* ==========================================
   UTIL
   ========================================== */
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.text-mono { font-family: var(--font-mono); }
.reveal { opacity: 0; transform: translateY(24px); }
.reveal.visible {
  opacity: 1; transform: none;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

/* Skip-to-content link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-2);
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  z-index: 9999;
  transition: top var(--t-fast);
}
.skip-link:focus {
  top: var(--space-2);
  color: #fff;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

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

/* Theme toggle — base; shell.css sizes the canopy control */
.theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.theme-toggle .ph {
  font-size: 18px;
  transition: transform var(--t-base), opacity var(--t-fast);
}
.theme-toggle .theme-icon--sun { display: inline-block; }
.theme-toggle .theme-icon--moon { display: none; }
[data-theme="light"] .theme-toggle .theme-icon--sun { display: none; }
[data-theme="light"] .theme-toggle .theme-icon--moon { display: inline-block; }
@media (max-width: 640px) {
  .theme-toggle { width: 36px; height: 36px; }
  .theme-toggle .ph { font-size: 16px; }
}
