/* Взыщи — Дизайн-система и токены
   Проект платформы ЛавЮрТех (vzyshi.lawjurtech.ru)
   Поддержка светлой и тёмной темы, доступности для дальтоников.
   Внешние шрифты не подключаются — системный безопасный стек. */

:root {
  /* Базовая палитра (Светлая тема) */
  --bg-page: #f7f5ef;
  --bg-surface: #fffefa;
  --bg-surface-elevated: #fffefa;
  --bg-subtle: #f0f1e9;
  --bg-muted: #e7eae0;

  --text-main: #183b31;
  --text-secondary: #53635b;
  --text-muted: #59665d;
  --text-inverse: #ffffff;

  --border-light: #dfe3d8;
  --border-base: #c8d1c4;
  --border-strong: #9cad98;

  /* Бренд-акцент: фирменный тёмно-зелёный «Взыщи» (как на главной) */
  --brand-primary: #17664b;
  --brand-primary-hover: #123e32;
  --brand-light: #e8f0e8;
  --brand-border: #c2d5bf;
  --brand-text: #123e32;

  /* Токены таймеров (4 цвета с иконками для дальтоников) */
  /* Зелёный: Можно сейчас */
  --timer-green-text: #166534;
  --timer-green-bg: #f0fdf4;
  --timer-green-border: #86efac;
  --timer-green-accent: #22c55e;

  /* Жёлтый: Скоро дедлайн */
  --timer-yellow-text: #854d0e;
  --timer-yellow-bg: #fefce8;
  --timer-yellow-border: #fef08a;
  --timer-yellow-accent: #eab308;

  /* Красный: Ход другой стороны / пока нельзя (тёплый терракот, не пугающий) */
  --timer-red-text: #9a3412;
  --timer-red-bg: #fff7ed;
  --timer-red-border: #fed7aa;
  --timer-red-accent: #f97316;

  /* Серый: Срок вышел — есть план Б */
  --timer-grey-text: #374151;
  --timer-grey-bg: #f3f4f6;
  --timer-grey-border: #d1d5db;
  --timer-grey-accent: #6b7280;

  /* Радиусы */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Тени */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

  /* Типографика: только системный стек (правило 6: без Google Fonts) */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Анимации (включаются/выключаются) */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --ring-duration: 4s;
}

/* Тёмная тема */
[data-theme="dark"] {
  --bg-page: #0f1419;
  --bg-surface: #182026;
  --bg-surface-elevated: #222c35;
  --bg-subtle: #1f2933;
  --bg-muted: #2d3748;

  --text-main: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-inverse: #111827;

  --border-light: #2d3748;
  --border-base: #374151;
  --border-strong: #4b5563;

  --brand-primary: #4fae88;
  --brand-primary-hover: #7cc7a6;
  --brand-light: #17302a;
  --brand-border: #2c5a4a;
  --brand-text: #a9dcc4;

  --timer-green-text: #86efac;
  --timer-green-bg: #064e3b;
  --timer-green-border: #059669;
  --timer-green-accent: #34d399;

  --timer-yellow-text: #fde047;
  --timer-yellow-bg: #713f12;
  --timer-yellow-border: #a16207;
  --timer-yellow-accent: #facc15;

  --timer-red-text: #fdba74;
  --timer-red-bg: #431407;
  --timer-red-border: #9a3412;
  --timer-red-accent: #fb923c;

  --timer-grey-text: #d1d5db;
  --timer-grey-bg: #1f2937;
  --timer-grey-border: #374151;
  --timer-grey-accent: #9ca3af;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
}

/* Базовые стили */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

/* Ссылки */
a {
  color: var(--brand-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.btn:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}
.btn--primary {
  background-color: var(--brand-primary);
  color: #ffffff;
}
.btn--primary:hover {
  background-color: var(--brand-primary-hover);
  text-decoration: none;
}
.btn--secondary {
  background-color: var(--bg-surface);
  border-color: var(--border-base);
  color: var(--text-main);
}
.btn--secondary:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-strong);
  text-decoration: none;
}
.btn--ghost {
  background-color: transparent;
  color: var(--text-secondary);
}
.btn--ghost:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  text-decoration: none;
}
.btn--danger {
  background-color: #dc2626;
  color: #ffffff;
}
.btn--danger:hover {
  background-color: #b91c1c;
  text-decoration: none;
}
.btn--danger-outline {
  background-color: transparent;
  border-color: #dc2626;
  color: #b91c1c;
}
.btn--danger-outline:hover {
  background-color: #fef2f2;
  border-color: #b91c1c;
  color: #991b1b;
  text-decoration: none;
}
.btn--sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* Контейнеры */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* Линейные SVG-значки (в строгом стиле главной страницы) */
.vz-icon {
  display: inline-block;
  vertical-align: -0.15em;
  stroke: currentColor;
  flex-shrink: 0;
}

/* Словарь юридических терминов: пунктирное подчёркивание */
.glossary-term {
  display: inline;
  background: transparent;
  border: none;
  border-bottom: 1.5px dotted var(--brand-primary);
  padding: 0 1px;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  cursor: help;
  text-decoration: none;
  border-radius: 2px;
  transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}
.glossary-term:hover,
.glossary-term:focus-visible,
.glossary-term[aria-expanded="true"] {
  color: var(--brand-primary);
  background-color: var(--brand-light);
  border-bottom-style: solid;
}
.glossary-term:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 1px;
}

/* Всплывающее окно пояснения термина */
.glossary-popover {
  position: absolute;
  z-index: 1000;
  background: var(--bg-surface-elevated, var(--bg-surface));
  color: var(--text-main);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.45;
  box-sizing: border-box;
}
.glossary-popover[hidden] {
  display: none !important;
}
.glossary-popover__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.glossary-popover__term {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-primary);
}
.glossary-popover__close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 14px;
  line-height: 1;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.glossary-popover__close:hover,
.glossary-popover__close:focus-visible {
  color: var(--text-main);
  background: var(--bg-subtle);
}
.glossary-popover__desc {
  margin: 0;
  color: var(--text-secondary);
}

/* Подсказки и мягкие предупреждения под полями ввода */
.form-hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-warning {
  font-size: 12px;
  line-height: 1.4;
  color: var(--timer-yellow-text);
  background: var(--timer-yellow-bg);
  border: 1px solid var(--timer-yellow-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  margin-top: 4px;
}

/* Тёмная тема: контурная кнопка опасного действия */
[data-theme="dark"] .btn--danger-outline {
  border-color: #f87171;
  color: #fca5a5;
}
[data-theme="dark"] .btn--danger-outline:hover {
  background-color: #450a0a;
  border-color: #ef4444;
  color: #fecaca;
}

/* Доступность: отключение анимаций и плавных переходов при prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

