/* ======================================================================
   AI Sector Design System v1
   Единственный источник фирменной палитры и базовых UI-токенов.

   Правило дальше: новые блоки НЕ получают новые случайные цвета.
   Берём переменные отсюда: фон, карточки, рамки, текст, акцент, рынок.
   ====================================================================== */

:root {
  /* Base background */
  --as-bg-page: #1f2020;
  --as-bg-deep: #10151f;
  --as-bg-panel: #151b27;

  /* Surfaces */
  --as-surface-0: rgba(255, 255, 255, 0.018);
  --as-surface-1: rgba(255, 255, 255, 0.032);
  --as-surface-2: rgba(255, 255, 255, 0.048);
  --as-surface-3: rgba(255, 255, 255, 0.066);
  --as-card-bg:
    radial-gradient(120% 140% at 0% 0%, rgba(var(--as-accent-rgb), .09), var(--as-surface-0) 55%, transparent 100%),
    linear-gradient(180deg, var(--as-surface-1), rgba(255, 255, 255, .01));
  --as-inner-bg: linear-gradient(180deg, var(--as-surface-1), rgba(255, 255, 255, .01));

  /* Borders / dividers */
  --as-border-soft: rgba(255, 255, 255, 0.045);
  --as-border: rgba(255, 255, 255, 0.070);
  --as-border-strong: rgba(255, 255, 255, 0.105);

  /* Text */
  --as-text: #c8ced8;
  --as-text-strong: #eef1f6;
  --as-heading: rgba(216, 220, 229, .76);
  --as-text-muted: #8f9bb3;
  --as-text-faint: #667085;

  /* Brand accent: calm warm amber/orange, not toxic yellow */
  --as-accent: #d98a1f;
  --as-accent-hover: #f0a340;
  --as-accent-active: var(--as-accent);
  --as-accent-rgb: 217, 138, 31;

  /* Market colors */
  --as-positive: #35d49a;
  --as-negative: #ff5c5c;
  --as-positive-rgb: 53, 212, 154;
  --as-negative-rgb: 255, 92, 92;

  /* Typography */
  --as-font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --as-font-size-base: 16px;
  --as-line-height: 1.6;
  --as-h2-size: clamp(18px, 1.2vw, 20px);
  --as-h1-size: clamp(20.7px, 1.38vw, 23px);
  --as-h3-size: clamp(13px, 1.02vw, 15px);
  --as-node-title-size: clamp(21px, 1.96vw, 31px);

  /* Radius */
  --as-radius-xs: 6px;
  --as-radius-sm: var(--as-radius-xs);
  --as-radius-md: var(--as-radius-xs);
  --as-radius-lg: var(--as-radius-xs);
  --as-radius-xl: var(--as-radius-xs);
  --as-radius-pill: 999px;

  /* Spacing */
  --as-space-1: 4px;
  --as-space-2: 8px;
  --as-space-3: 12px;
  --as-space-4: 16px;
  --as-space-5: 20px;
  --as-space-6: 24px;
  --as-space-8: 32px;

  /* Shadows */
  --as-shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.20);
  --as-shadow-card: 0 14px 34px rgba(0, 0, 0, 0.24);

  /* Legacy aliases: чтобы старые компоненты не ломались. */
  --ai-orange: var(--as-accent);
  --ai-pos: var(--as-positive);
  --ai-neg: var(--as-negative);
  --ai-line: var(--as-border);
  --ai-bg: var(--as-surface-1);
}

html {
  color-scheme: dark;
}

body {
  background: var(--as-bg-page);
  color: var(--as-text);
  font-family: var(--as-font-sans);
}

a {
  color: var(--as-accent);
}

a:hover,
a:focus-visible {
  color: var(--as-accent-hover);
}

.positive,
.is-positive,
.val-pos,
.chip-pos {
  color: var(--as-positive) !important;
}

.negative,
.is-negative,
.val-neg,
.chip-neg {
  color: var(--as-negative) !important;
}

/* Future reusable primitives. Использовать для новых блоков. */
.as-card {
  background: var(--as-card-bg);
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius-lg);
  box-shadow: var(--as-shadow-soft);
}

.as-card-soft {
  background: var(--as-inner-bg);
  border: 1px solid var(--as-border-soft);
  border-radius: var(--as-radius-md);
}

.as-section-title {
  color: var(--as-text-strong);
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
}

/* Branded headings.
   Use this component instead of styling raw h1/h2/h3 in feature CSS. */
.as-heading {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 0 0 14px;
  padding-bottom: 9px;
  color: var(--as-heading);
  font-weight: 850;
  line-height: 1.18;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.as-heading::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(var(--as-accent-rgb), .34),
    var(--as-border-strong),
    rgba(0, 0, 0, 0)
  );
}

.as-heading::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 24px;
  height: 3px;
  transform: translateX(-50%);
  border-radius: var(--as-radius-pill);
  background: var(--as-accent);
  box-shadow: 0 0 12px rgba(var(--as-accent-rgb), .5);
}

.as-heading__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--as-radius-md);
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.018)),
    rgba(0, 0, 0, .08);
  color: var(--as-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.as-heading--h1 {
  min-height: 0;
  font-size: calc(var(--as-h2-size) * .9);
}

.as-heading--plain {
  display: block;
  min-height: 0;
  margin: 0;
  padding-bottom: 0;
}

.as-heading--plain::before,
.as-heading--plain::after {
  content: none;
}

.as-heading--no-icon {
  gap: 0;
}

.as-heading--h2 {
  min-height: 32px;
  font-size: calc(var(--as-h2-size) * .8);
}

.as-heading--h3 {
  min-height: 28px;
  margin-bottom: 10px;
  padding-bottom: 7px;
  font-size: calc(var(--as-h3-size) * .9);
}

.as-heading--h1 .as-heading__icon {
  width: 36px;
  height: 36px;
  font-size: 15px;
}

.as-heading--h2 .as-heading__icon {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.as-heading--h3 .as-heading__icon {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.as-heading--h3::before {
  width: 22px;
}

.as-eyebrow {
  color: var(--as-text-muted);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.as-muted {
  color: var(--as-text-muted);
}

.as-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--as-radius-pill);
  color: var(--as-accent);
  background: rgba(var(--as-accent-rgb), 0.10);
  border: 1px solid rgba(var(--as-accent-rgb), 0.22);
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
}

.as-chip:hover {
  color: var(--as-accent-hover);
  border-color: rgba(var(--as-accent-rgb), 0.36);
  text-decoration: none;
}

.as-button,
.as-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--as-radius-pill);
  border: 1px solid var(--as-border);
  background: var(--as-surface-2);
  color: var(--as-text-muted);
  font-weight: 800;
  text-decoration: none;
}

.as-button:hover,
.as-tab:hover {
  color: var(--as-text-strong);
  border-color: rgba(var(--as-accent-rgb), 0.35);
  text-decoration: none;
}

.as-button.is-active,
.as-tab.is-active {
  color: #141414;
  background: var(--as-accent-active);
  border-color: transparent;
}
