/* ============================================================
   «Книга про тебя и твоих людей» — дизайн-токены и базовые компоненты
   Единый источник правды для front.css и admin.css.
   Направление: «Тёплая книга» — выбор фокус-группы 200 чел. (63/200)
   и аудита. Все цветовые пары проверены на WCAG 2.1 AA (≥4.5:1).
   Подробности и примеры: /design/ui-kit.html
   ============================================================ */

/* ---------- Шрифты (self-hosted, кириллица+латиница) ---------- */
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/literata-cyrillic-600-normal.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/literata-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/literata-cyrillic-700-normal.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/literata-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122; }

@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/golos-text-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/golos-text-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/golos-text-cyrillic-500-normal.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/golos-text-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/golos-text-cyrillic-600-normal.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/golos-text-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/golos-text-cyrillic-700-normal.woff2') format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/golos-text-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122; }

/* ---------- Токены ---------- */
:root {
  /* Цвет: бумага и чернила */
  --paper: #faf6ee;          /* тёплый бумажный фон */
  --card: #ffffff;           /* поверхность карточек */
  --ink: #33291e;            /* основной текст, 13.2:1 на бумаге */
  --muted: #6b6156;          /* вторичный текст, 5.6:1 на бумаге */
  --line: #e9e1d2;           /* основной делитель */
  --line-soft: #f1ead9;      /* лёгкий делитель / подложки */

  /* Терракота — акцент бренда */
  --terra-50: #faeee5;
  --terra-100: #f4ddcc;
  --terra-600: #96411c;      /* кнопки, ссылки: белый на нём 6.8:1 */
  --terra-700: #7e3616;      /* hover: затемняем, не осветляем */
  --accent: var(--terra-600);
  --accent-strong: var(--terra-700);

  /* Золото — маркер ТОЛЬКО платного контура («полная книга») */
  --gold-100: #f7ecd4;
  --gold-300: #e4cf9c;
  --gold-700: #8a6a2e;       /* золотые кнопки: белый на нём 5.0:1 */
  --gold-800: #75591f;       /* hover */
  --gold-text: #7a5f2a;      /* текст на золотой подложке 5.1:1 */

  /* Статусы */
  --ok: #1e6b4f;   --ok-bg: #eaf4ee;
  --err: #a03a30;  --err-bg: #fbece9;

  /* Бренды мессенджеров (контраст с белым ≥5.4:1) */
  --brand-wa: #0d7a3a; --brand-wa-strong: #0b6a33;
  --brand-tg: #176f9e; --brand-tg-strong: #135e86;

  /* Обложка книги/отчёта */
  --cover-from: #8a3c1a;
  --cover-to: #a0481f;

  /* Типографика */
  --font-display: 'Literata', 'PT Serif', Georgia, serif;
  --font-body: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-xs: .75rem;
  --fs-sm: .875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --fs-hero: clamp(1.9rem, 6vw, 2.6rem);

  /* Отступы (сетка 4px) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;

  /* Радиусы */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-full: 999px;

  /* Тени (тёплые чернила) */
  --shadow-1: 0 1px 3px rgba(51, 41, 30, .07);
  --shadow-2: 0 6px 18px rgba(51, 41, 30, .11);
  --shadow-3: 0 16px 40px rgba(51, 41, 30, .18);

  /* Совместимость со старыми именами токенов */
  --bg: var(--paper);
  --gold: var(--gold-700);
  --radius: var(--r-lg);
}

/* ---------- База ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* перебивает display:grid/flex у скрытых секций */
body { margin: 0; font-family: var(--font-body); color: var(--ink);
  background: var(--paper); line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }

h1, h2, h3, .font-display { font-family: var(--font-display); letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); line-height: 1.22; margin: .4em 0; font-weight: 700; }
h2 { font-size: var(--fs-lg); line-height: 1.3; margin: 0 0 .6em; font-weight: 700; }
h3 { font-size: var(--fs-md); line-height: 1.35; margin: 0 0 .4em; font-weight: 600; }

/* Видимый фокус — везде (WCAG 2.4.7) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; }

/* Только для скринридеров */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Иконки (inline SVG, currentColor) ---------- */
.ic { width: 1.15em; height: 1.15em; flex: 0 0 auto; vertical-align: -.2em; stroke: currentColor;
  fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic-lg { width: 1.5em; height: 1.5em; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: 0; cursor: pointer;
  padding: 12px 20px; min-height: 44px; border-radius: var(--r-md);
  font-family: var(--font-body); font-size: var(--fs-sm); font-weight: 600;
  text-decoration: none; line-height: 1.2;
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease; }
.btn:hover { background: var(--accent-strong); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-big { width: 100%; padding: 15px 22px; font-size: var(--fs-base); box-shadow: var(--shadow-1); }
.btn-ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-ghost:hover { background: var(--terra-50); color: var(--accent-strong); border-color: var(--accent-strong); }
.btn-wa { background: var(--brand-wa); } .btn-wa:hover { background: var(--brand-wa-strong); }
.btn-tg { background: var(--brand-tg); } .btn-tg:hover { background: var(--brand-tg-strong); }
.btn-gold { background: var(--gold-700); color: #fff; }
.btn-gold:hover { background: var(--gold-800); color: #fff; }
.btn-sm { padding: 8px 12px; min-height: 36px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer;
  padding: 10px 4px; min-height: 44px; display: inline-flex; align-items: center;
  font-family: var(--font-body); font-size: var(--fs-sm); text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--accent-strong); }

/* ---------- Бейджи ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 600; background: var(--line-soft); color: var(--muted); }
.badge-gold { display: inline-block; background: var(--gold-100); color: var(--gold-text);
  border: 1px solid var(--gold-300); border-radius: var(--r-full);
  padding: 3px 12px; font-size: var(--fs-xs); font-weight: 700; }

/* ---------- Формы ---------- */
form label { display: block; margin: var(--sp-4) 0 0; font-size: var(--fs-sm); font-weight: 600; }
form input[type=text], form input[type=tel], form input[type=date], form input[type=time],
form input[type=number], form input[type=password], form select, form textarea, .input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; min-height: 46px;
  font-family: var(--font-body); font-size: var(--fs-base);
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--card); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease; }
form input:focus, form select:focus, form textarea:focus, .input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--terra-50); }
form small { font-weight: 400; color: var(--muted); }
.form-error { display: none; background: var(--err-bg); color: var(--err);
  border-radius: var(--r-sm); padding: 11px 14px; margin-top: var(--sp-3); font-size: var(--fs-sm); }

/* ---------- Модалки ---------- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(51, 41, 30, .5);
  z-index: 100; align-items: flex-start; justify-content: center; overflow-y: auto;
  padding: var(--sp-6) var(--sp-3); }
.modal-overlay.open { display: flex; }
.modal { background: var(--card); border-radius: var(--r-lg); width: 100%; max-width: 460px;
  box-shadow: var(--shadow-3); }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line-soft); }
.modal-header h3, .modal-title { margin: 0; font-size: var(--fs-md); }
.modal-close { background: none; border: 0; cursor: pointer; color: var(--muted);
  font-size: 1.4rem; line-height: 1; padding: 8px; margin: -8px; min-width: 44px; min-height: 44px;
  border-radius: var(--r-sm); }
.modal-close:hover { color: var(--ink); background: var(--line-soft); }
.modal-body { padding: var(--sp-4) var(--sp-5) var(--sp-5); }
.modal-actions { display: flex; gap: var(--sp-3); justify-content: flex-end; margin-top: var(--sp-5); }

/* ---------- Уведомления ---------- */
.alert { padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: var(--sp-4); font-size: var(--fs-sm); }
.alert-error { background: var(--err-bg); color: var(--err); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }

.tiny { font-size: var(--fs-xs); color: var(--muted); }
