/* Typography Styles */
/* Расширенные типографические стили для лендинга AIКонтур */

/* ===== АДАПТИВНЫЕ ЗАГОЛОВКИ ===== */

/* H1 - главный заголовок (Hero) */
h1,
.heading-1 {
  font-size: clamp(2rem, 4vw + 1rem, 4rem);
  /* 32px на mobile (320px), 64px на desktop (1440px+) */
  font-weight: var(--font-weight-bold);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-6);
  color: var(--color-neutral-900);
}

/* H2 - заголовки секций */
h2,
.heading-2 {
  font-size: clamp(1.5rem, 3vw + 0.5rem, 3rem);
  /* 24px на mobile, 48px на desktop */
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-5);
  color: var(--color-neutral-900);
}

/* H3 - подзаголовки внутри секций */
h3,
.heading-3 {
  font-size: clamp(1.25rem, 2vw + 0.5rem, 2.25rem);
  /* 20px на mobile, 36px на desktop */
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
  margin-bottom: var(--space-4);
  color: var(--color-neutral-800);
}

/* H4 - мелкие заголовки (карточки) */
h4,
.heading-4 {
  font-size: clamp(1.125rem, 1.5vw + 0.5rem, 1.875rem);
  /* 18px на mobile, 30px на desktop */
  font-weight: var(--font-weight-semibold);
  line-height: 1.4;
  margin-bottom: var(--space-3);
  color: var(--color-neutral-800);
}

/* H5, H6 - редко используются */
h5,
.heading-5 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-medium);
  line-height: 1.5;
  margin-bottom: var(--space-2);
  color: var(--color-neutral-700);
}

h6,
.heading-6 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  line-height: 1.5;
  margin-bottom: var(--space-2);
  color: var(--color-neutral-700);
}

/* ===== ТЕКСТОВЫЕ КЛАССЫ ===== */

/* Lead text - крупный вводный текст */
.text-lead {
  font-size: clamp(1.125rem, 1.5vw + 0.5rem, 1.5rem);
  /* 18px на mobile, 24px на desktop */
  line-height: var(--line-height-loose);
  font-weight: var(--font-weight-medium);
  color: var(--color-neutral-700);
  max-width: 65ch;
  margin-bottom: var(--space-5);
}

/* Body text - обычный текст (уже есть в base.css, дополняем) */
.text-body {
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-neutral-800);
  max-width: 75ch;
}

/* Small text - мелкий текст (футер, подписи) */
.text-small {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  color: var(--color-neutral-600);
}

/* Tagline - короткая ударная фраза */
.text-tagline {
  font-size: clamp(1rem, 1.5vw + 0.5rem, 1.25rem);
  /* 16px на mobile, 20px на desktop */
  font-weight: var(--font-weight-semibold);
  line-height: 1.4;
  color: var(--color-neutral-800);
  margin-bottom: var(--space-4);
}

/* Quote - цитаты (если нужны) */
blockquote,
.text-quote {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-loose);
  font-style: italic;
  color: var(--color-neutral-700);
  border-left: 4px solid var(--color-primary-500);
  padding-left: var(--space-4);
  margin: var(--space-6) 0;
  max-width: 65ch;
}

/* ===== ПАРАГРАФЫ ===== */

/* Параграфы с оптимальной длиной строки */
p {
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  margin-bottom: var(--space-4);
  max-width: 75ch;
  color: var(--color-neutral-800);
}

/* Параграфы внутри секций могут иметь другие отступы */
section p:last-child {
  margin-bottom: 0;
}

/* ===== СПИСКИ ===== */

/* Контентные списки (сброс был в reset.css, теперь стилизуем) */
article ul,
article ol,
.content ul,
.content ol,
section ul,
section ol {
  margin-bottom: var(--space-6);
  padding-left: var(--space-8);
}

/* Маркированные списки */
article ul li,
.content ul li,
section ul li {
  position: relative;
  margin-bottom: var(--space-3);
  padding-left: var(--space-2);
  list-style: none;
}

article ul li::before,
.content ul li::before,
section ul li::before {
  content: "•";
  position: absolute;
  left: calc(-1 * var(--space-6));
  color: var(--color-primary-500);
  font-weight: var(--font-weight-bold);
  font-size: 1.2em;
}

/* Нумерованные списки */
article ol,
.content ol,
section ol {
  counter-reset: list-counter;
}

article ol li,
.content ol li,
section ol li {
  counter-increment: list-counter;
  position: relative;
  margin-bottom: var(--space-3);
  padding-left: var(--space-2);
  list-style: none;
}

article ol li::before,
.content ol li::before,
section ol li::before {
  content: counter(list-counter) ".";
  position: absolute;
  left: calc(-1 * var(--space-8));
  color: var(--color-primary-600);
  font-weight: var(--font-weight-semibold);
  min-width: var(--space-5);
  text-align: right;
}

/* Вложенные списки */
article ul ul,
article ol ol,
.content ul ul,
.content ol ol,
section ul ul,
section ol ol {
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
}

/* ===== UTILITY КЛАССЫ ===== */

/* Text alignment */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* Font weights */
.text-bold {
  font-weight: var(--font-weight-bold);
}

.text-semibold {
  font-weight: var(--font-weight-semibold);
}

.text-medium {
  font-weight: var(--font-weight-medium);
}

.text-normal {
  font-weight: var(--font-weight-normal);
}

/* Text colors */
.text-muted {
  color: var(--color-neutral-600);
}

.text-highlight {
  color: var(--color-primary-600);
}

.text-accent {
  color: var(--color-primary-500);
}

.text-success {
  color: var(--color-success);
}

.text-warning {
  color: var(--color-warning);
}

.text-error {
  color: var(--color-error);
}

/* Text transform */
.text-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.text-lowercase {
  text-transform: lowercase;
}

.text-capitalize {
  text-transform: capitalize;
}

/* Font styles */
.text-italic {
  font-style: italic;
}

.text-underline {
  text-decoration: underline;
}

/* Line height overrides */
.line-height-tight {
  line-height: var(--line-height-tight);
}

.line-height-normal {
  line-height: var(--line-height-normal);
}

.line-height-loose {
  line-height: var(--line-height-loose);
}

/* ===== SELECTION СТИЛЬ ===== */

::selection {
  background-color: var(--color-primary-200);
  color: var(--color-primary-900);
  text-shadow: none;
}

::-moz-selection {
  background-color: var(--color-primary-200);
  color: var(--color-primary-900);
  text-shadow: none;
}

/* ===== АДАПТИВНОСТЬ ===== */

/* Дополнительные корректировки для больших экранов */
@media (min-width: 1024px) {
  /* Увеличиваем max-width для параграфов на больших экранах */
  p,
  .text-body {
    max-width: 80ch;
  }

  .text-lead {
    max-width: 70ch;
  }
}

/* Корректировки для очень маленьких экранов */
@media (max-width: 375px) {
  /* Уменьшаем отступы списков на малых экранах */
  article ul,
  article ol,
  .content ul,
  .content ol,
  section ul,
  section ol {
    padding-left: var(--space-6);
  }
}

/* ===== WORD BREAK ===== */

/* Предотвращаем overflow для длинных слов */
h1,
h2,
h3,
h4,
h5,
h6,
p,
.text-lead,
.text-body,
.text-tagline {
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* ===== ACCESSIBILITY ===== */

/* Увеличенный размер шрифта при zoom не должен ломать верстку */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Print styles для типографики */
@media print {
  h1,
  h2,
  h3 {
    page-break-after: avoid;
  }

  p,
  li {
    orphans: 3;
    widows: 3;
  }

  blockquote {
    page-break-inside: avoid;
  }
}
