/* ============================================================
   /teoriya/ — Умный справочник kritika24
   Компактные карточки + структурированные группы по линиям ЕГЭ.
   ============================================================ */

:root {
  --teor-blue:   #4f46e5;
  --teor-amber:  #d97706;
  --teor-green:  #059669;
  --teor-purple: #9333ea;
  --teor-rose:   #e11d48;
}

/* HERO */
.teor-hero {
  background: linear-gradient(135deg, #eef2ff 0%, #fdf2f8 100%);
  padding: 56px 16px 40px;
  border-bottom: 1px solid #e5e7eb;
}
.teor-hero-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.teor-hero-badge {
  display: inline-block;
  font-size: 13px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  padding: 5px 14px;
  margin-bottom: 14px;
  color: #475569;
  font-weight: 500;
}
.teor-hero h1 {
  font-size: clamp(26px, 4.5vw, 38px);
  line-height: 1.15;
  margin: 0 0 12px;
  font-weight: 800;
  color: #0f172a;
}
.teor-hero p {
  font-size: 16px;
  line-height: 1.5;
  color: #475569;
  margin: 0 0 24px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.teor-stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.teor-stat strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}
.teor-stat span {
  font-size: 12px;
  color: #64748b;
}
.teor-stat-sep {
  width: 1px;
  height: 28px;
  background: #cbd5e1;
}

/* SECTION */
.teor-section {
  padding: 32px 16px 64px;
}
.teor-section > .container {
  max-width: 880px;
  margin: 0 auto;
}

/* GROUPS — иерархический нумерованный список как у neofamily smart-directory */
.teor-groups {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: teor-group;
}
.teor-group {
  margin: 0 0 28px;
  padding: 0;
}
.teor-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
}
.teor-group-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.teor-group-num.blue   { background: #eef2ff; color: var(--teor-blue); }
.teor-group-num.amber  { background: #fef3c7; color: var(--teor-amber); }
.teor-group-num.green  { background: #d1fae5; color: var(--teor-green); }
.teor-group-num.purple { background: #f3e8ff; color: var(--teor-purple); }
.teor-group-num.rose   { background: #ffe4e6; color: var(--teor-rose); }

.teor-group-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.teor-group-name {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  flex: 0 1 auto;
}
.teor-group-sub {
  font-size: 12px;
  color: #94a3b8;
  flex: 1;
  margin-left: 4px;
}
.teor-count-badge {
  font-size: 12px;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 9px;
  border-radius: 9999px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ARTICLE ROWS — список внутри группы */
.teor-articles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.teor-articles li {
  margin: 0;
  padding: 0;
}
.teor-row-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.teor-row {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background .1s, border-color .1s;
}
.teor-row:hover {
  background: #f8fafc;
  border-color: #e0e7ff;
}
.teor-trainer-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  min-width: 44px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #6366f1;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .1s, border-color .1s, color .1s;
}
.teor-trainer-btn:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}
.teor-trainer-btn svg { flex-shrink: 0; }
.teor-row-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 0 6px;
  height: 28px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  letter-spacing: -.3px;
}
.teor-row-num.blue   { background: #eef2ff; color: var(--teor-blue); }
.teor-row-num.amber  { background: #fef3c7; color: var(--teor-amber); }
.teor-row-num.green  { background: #d1fae5; color: var(--teor-green); }
.teor-row-num.purple { background: #f3e8ff; color: var(--teor-purple); }
.teor-row-num.rose   { background: #ffe4e6; color: var(--teor-rose); }

.teor-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.teor-row-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
}
.teor-row-desc {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.teor-row-time {
  flex-shrink: 0;
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
}
.teor-row-arrow {
  flex-shrink: 0;
  color: #cbd5e1;
}
.teor-row:hover .teor-row-arrow {
  color: #6366f1;
}

.teor-empty {
  text-align: center;
  padding: 48px 16px;
  color: #64748b;
}

/* ============================================================
   ARTICLE PAGE — без изменений (компактные блоки уже норм)
   ============================================================ */
.teor-breadcrumbs {
  padding: 24px 16px 8px;
  font-size: 14px;
  color: #64748b;
  display: flex;
  gap: 8px;
  align-items: center;
}
.teor-breadcrumbs a { color: #4338ca; text-decoration: none; }
.teor-breadcrumbs a:hover { text-decoration: underline; }

.teor-article {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 80px;
}
.teor-article-head {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f1f5f9;
}
.teor-article-num {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  background: #eef2ff;
  color: #4338ca;
  padding: 3px 12px;
  border-radius: 9999px;
  margin-bottom: 12px;
}
.teor-article-head h1 {
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.2;
  margin: 0 0 10px;
  font-weight: 800;
  color: #0f172a;
}
.teor-article-meta {
  font-size: 14px;
  color: #64748b;
}

.teor-article-body {
  font-size: 17px;
  line-height: 1.7;
  color: #1e293b;
}
.teor-article-body h2 {
  font-size: 22px;
  margin-top: 36px;
  margin-bottom: 14px;
  font-weight: 700;
  color: #0f172a;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
}
.teor-article-body h3 {
  font-size: 18px;
  margin-top: 24px;
  margin-bottom: 10px;
  font-weight: 600;
  color: #1e293b;
}
.teor-article-body p { margin: 0 0 14px; }
.teor-article-body ul, .teor-article-body ol { margin: 0 0 14px; padding-left: 24px; }
.teor-article-body li { margin-bottom: 5px; }
.teor-article-body strong { color: #0f172a; }
.teor-article-body em { color: #475569; }
.teor-article-body blockquote {
  margin: 18px 0;
  padding: 12px 18px;
  background: #f8fafc;
  border-left: 4px solid #6366f1;
  color: #475569;
  font-style: italic;
}
.teor-article-body code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .92em;
}
.teor-article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 15px;
}
.teor-article-body th, .teor-article-body td {
  border: 1px solid #e5e7eb;
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.teor-article-body th { background: #f8fafc; font-weight: 600; }
.teor-article-body a {
  color: #4338ca;
  text-decoration: underline;
}

/* INLINE TRAINER */
.teor-article-body details {
  margin: 12px 0;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.teor-article-body details summary {
  cursor: pointer;
  font-weight: 600;
  color: #4338ca;
  list-style: none;
  user-select: none;
}
.teor-article-body details summary::-webkit-details-marker { display: none; }
.teor-article-body details summary::before {
  content: "▶ ";
  display: inline-block;
  margin-right: 6px;
  transition: transform .15s;
  font-size: .85em;
}
.teor-article-body details[open] summary::before {
  transform: rotate(90deg);
}
.teor-article-body details > *:not(summary) {
  margin-top: 10px;
}

/* TRAINER CTA */
.teor-trainer-cta {
  margin: 36px 0 20px;
  padding: 22px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.teor-trainer-cta-text { flex: 1; min-width: 200px; }
.teor-trainer-cta h3 { margin: 0 0 4px; font-size: 19px; color: #fff; }
.teor-trainer-cta p { margin: 0; font-size: 14px; opacity: .9; }
.teor-trainer-cta-btn {
  display: inline-block;
  background: #fff;
  color: #4338ca;
  padding: 11px 22px;
  border-radius: 9999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  transition: transform .12s, box-shadow .12s;
}
.teor-trainer-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

/* RELATED */
.teor-related {
  margin: 28px 0;
  padding: 16px 20px;
  background: #f8fafc;
  border-radius: 12px;
}
.teor-related h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #475569;
  font-weight: 600;
}
.teor-related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.teor-related a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4338ca;
  text-decoration: none;
  padding: 4px 0;
}
.teor-related a:hover { text-decoration: underline; }
.teor-related-num {
  display: inline-block;
  background: #eef2ff;
  color: #4338ca;
  padding: 1px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.teor-article-foot {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}
.teor-article-foot a { color: #4338ca; text-decoration: none; }
.teor-article-foot a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .teor-hero { padding: 36px 16px 28px; }
  .teor-row { padding: 8px 10px; gap: 8px; }
  .teor-row-num { min-width: 36px; height: 26px; font-size: 11px; }
  .teor-row-title { font-size: 13.5px; }
  .teor-row-desc { font-size: 12px; }
  .teor-row-time { display: none; }
  .teor-group-sub { display: none; }
  .teor-trainer-cta { padding: 18px; }
  .teor-trainer-cta-btn { width: 100%; text-align: center; }
  .teor-trainer-btn { padding: 0 8px; min-width: 36px; font-size: 0; }
  .teor-trainer-btn-label { display: none; }
  .teor-row-wrap { gap: 4px; }
}

/* ============================================================
   VISUAL AIDS — таблицы, карточки, callout, flow-обёртка
   Используются в body_html статей теории. Семантический HTML
   (а не SVG-с-текстом) даёт лучшую индексацию в Google/AI-search,
   копируется и доступен для скринридеров.
   ============================================================ */

/* ---- 1. Сравнительные таблицы ---- */
/* Применять для «сравни N сущностей по M атрибутам»: стили речи, нормы,
   разряды чисел и т.п. Семантическая <table>, на мобиле — горизонтальный скролл. */
.teor-article-body .teor-table-wrap {
  overflow-x: auto;
  margin: 24px -4px;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
}
.teor-article-body .teor-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14.5px;
  line-height: 1.45;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  min-width: 600px;
}
.teor-article-body .teor-table thead th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  font-size: 13px;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.teor-article-body .teor-table tbody td {
  padding: 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  color: #0f172a;
}
.teor-article-body .teor-table tbody tr:last-child td { border-bottom: 0; }
.teor-article-body .teor-table tbody td:first-child {
  font-weight: 700;
  width: 18%;
  min-width: 130px;
}

/* Цветовые акценты строк (для 5 стилей и подобных классификаций).
   Левая полоса 4px + лёгкая заливка первой колонки. Палитра — фирменная. */
.teor-article-body .teor-table tr.teor-row--blue   td:first-child { box-shadow: inset 4px 0 0 #4f46e5; background: #eef2ff; color: #4338ca; }
.teor-article-body .teor-table tr.teor-row--gray   td:first-child { box-shadow: inset 4px 0 0 #475569; background: #f1f5f9; color: #1e293b; }
.teor-article-body .teor-table tr.teor-row--amber  td:first-child { box-shadow: inset 4px 0 0 #d97706; background: #fef3c7; color: #b45309; }
.teor-article-body .teor-table tr.teor-row--rose   td:first-child { box-shadow: inset 4px 0 0 #e11d48; background: #ffe4e6; color: #be185d; }
.teor-article-body .teor-table tr.teor-row--green  td:first-child { box-shadow: inset 4px 0 0 #059669; background: #d1fae5; color: #15803d; }
.teor-article-body .teor-table tr.teor-row--purple td:first-child { box-shadow: inset 4px 0 0 #9333ea; background: #f3e8ff; color: #7c3aed; }

/* ---- 2. Карточки (группировка понятий) ---- */
/* Применять для «список разнотипных понятий с пояснениями»: тропы, фигуры
   речи, виды ошибок, типы вопросов. Грид адаптивный. */
.teor-article-body .teor-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.teor-article-body .teor-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #475569;
  border-radius: 10px;
  padding: 14px 16px;
}
.teor-article-body .teor-card h4 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.teor-article-body .teor-card p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
  color: #475569;
}
.teor-article-body .teor-card code,
.teor-article-body .teor-card .teor-card__example {
  display: block;
  background: #f8fafc;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: #1e293b;
  font-family: inherit;
  font-style: italic;
}
/* Цветовые акценты карточек */
.teor-article-body .teor-card--blue   { border-left-color: #4f46e5; }
.teor-article-body .teor-card--amber  { border-left-color: #d97706; }
.teor-article-body .teor-card--green  { border-left-color: #059669; }
.teor-article-body .teor-card--rose   { border-left-color: #e11d48; }
.teor-article-body .teor-card--purple { border-left-color: #9333ea; }

/* ---- 3. Callout (ловушки, важное правило, шпаргалка) ---- */
.teor-article-body .teor-callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  margin: 20px 0;
  border-radius: 10px;
  border-left: 4px solid #475569;
  background: #f8fafc;
  font-size: 14.5px;
  line-height: 1.5;
  color: #1e293b;
}
.teor-article-body .teor-callout::before {
  content: attr(data-icon);
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1.4;
}
.teor-article-body .teor-callout > div { flex: 1; }
.teor-article-body .teor-callout strong { color: #0f172a; }
.teor-article-body .teor-callout--warning { border-left-color: #d97706; background: #fef3c7; }
.teor-article-body .teor-callout--danger  { border-left-color: #e11d48; background: #ffe4e6; }
.teor-article-body .teor-callout--success { border-left-color: #059669; background: #d1fae5; }
.teor-article-body .teor-callout--info    { border-left-color: #4f46e5; background: #eef2ff; }

/* ---- 4. Flow-обёртка для inline-SVG (алгоритмы со стрелками) ---- */
/* Применять ТОЛЬКО для реально визуальных диаграмм (стрелки, кружки, связи).
   Текстовая информация → таблица или карточки, не SVG. */
.teor-article-body .teor-flow {
  margin: 24px 0;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}
.teor-article-body .teor-flow svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 720px;
  margin: 0 auto;
}
.teor-article-body .teor-flow figcaption {
  text-align: center;
  font-size: 13px;
  color: #64748b;
  margin-top: 8px;
}
