@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
  --bg: #0b0f1a;
  --panel: #111827;
  --panel-alt: #0b1220;
  --muted: #9aa5b1;
  --text: #e5e7eb;
  --primary: #2563eb;
  --accent: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #1f2937;
  --shadow: 0 10px 24px rgba(0,0,0,.35);
  --shadow-sm: 0 6px 14px rgba(0,0,0,.25);
}

:root[data-theme="light"] {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-alt: #f8fafc;
  --muted: #475569;
  --text: #0f172a;
  --primary: #2563eb;
  --accent: #0ea5e9;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --border: #e5e7eb;
  --shadow: 0 10px 24px rgba(9,12,20,.12);
  --shadow-sm: 0 6px 14px rgba(9,12,20,.10);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.header-wrap {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.logo { color: var(--text); text-decoration: none; font-weight: 700; font-size: 22px; letter-spacing: .2px; }
.tag { color: var(--muted); font-size: 14px; }
.sub { color: var(--muted); font-size: 13px; }

.nav { background: var(--panel); border-bottom: 1px solid var(--border); backdrop-filter: saturate(140%) blur(6px); }
.nav-list { list-style: none; display: flex; gap: 12px; margin: 0; padding: 12px 24px; flex-wrap: wrap; }
.nav-list { justify-content: center; }
.nav-list a {
  --bgk: rgba(255,255,255,.04);
  --brk: var(--border);
  color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 12px; background: var(--bgk);
  border: 1px solid var(--brk);
  box-shadow: inset 0 -2px 0 rgba(255,255,255,.06), 0 1px 0 rgba(0,0,0,.2);
  transition: transform .12s ease, box-shadow .12s ease, background .2s ease;
}
.nav-list a[aria-disabled="true"] { color: var(--muted); opacity: .7; pointer-events: none; }
.nav-list a:hover { transform: translateY(-1px); background: rgba(255,255,255,.06); }
.nav-list a:active { transform: translateY(0); }

/* Светлая тема: корректные фоны для ссылок меню и keycap */
:root[data-theme="light"] .nav-list a { --bgk: rgba(0,0,0,.04); box-shadow: inset 0 -2px 0 rgba(0,0,0,.06), 0 1px 0 rgba(9,12,20,.10); }
:root[data-theme="light"] .nav-list a:hover { background: rgba(0,0,0,.06); }

.keycap { /* универсальный стиль «клавиши» */
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.04);
  border: 1px solid var(--border); color: var(--text);
  box-shadow: inset 0 -2px 0 rgba(255,255,255,.06), 0 1px 0 rgba(0,0,0,.2);
  cursor: pointer; transition: transform .12s ease, background .2s ease;
}
.keycap:hover { transform: translateY(-1px); background: rgba(255,255,255,.06); }
.keycap:active { transform: translateY(0); }
:root[data-theme="light"] .keycap { background: rgba(0,0,0,.04); box-shadow: inset 0 -2px 0 rgba(0,0,0,.06), 0 1px 0 rgba(9,12,20,.10); }
:root[data-theme="light"] .keycap:hover { background: rgba(0,0,0,.06); }

.hero {
  background:
    radial-gradient(800px 300px at 20% 0%, rgba(37,99,235,.18), transparent),
    linear-gradient(135deg, rgba(37,99,235,.10), rgba(14,165,233,.10));
  border: 1px solid var(--border); border-radius: 16px; padding: 28px; margin-top: 24px;
}
.hero h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: .2px; }
.hero p { color: var(--muted); margin: 0; font-size: 15px; }

.articles h2 { margin-top: 32px; }
.articles-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 12px;
}
@media (max-width: 900px) { .articles-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .articles-grid { grid-template-columns: 1fr; } }

/* Мобильная центровка шапки */
@media (max-width: 900px) {
  .header-wrap { flex-direction: column; align-items: center; text-align: center; gap: 8px; }
  .brand { align-items: center; justify-content: center; }
  .header-cta { display: flex; align-items: center; justify-content: center; gap: 10px; }
}

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .2s ease, border-color .2s ease;
}
.card .thumb { height: 140px; background: var(--panel-alt); border-bottom: 1px solid var(--border); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 16px; }
.card h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: .2px; }
.card p { margin: 0; color: var(--muted); }
.card .meta { display: flex; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.card .actions { display: flex; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); }
.card:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(0,0,0,.4); border-color: rgba(255,255,255,.16); }
.btn {
  appearance: none; border: 1px solid var(--border); color: var(--text); background: var(--panel);
  padding: 10px 14px; border-radius: 12px; text-decoration: none; font-size: 14px;
  transition: transform .12s ease, background .2s ease, border-color .2s ease, box-shadow .12s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }

.partner-block { margin-top: 28px; }
.partner-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.partner-link { color: var(--accent); text-decoration: none; }
.partner-link:hover { text-decoration: underline; }

.footer { margin-top: 32px; background: var(--panel); border-top: 1px solid var(--border); }
.footer-wrap { padding: 20px 24px; }
.footer-columns { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .footer-columns { grid-template-columns: 1fr; justify-items: center; } }
.footer h4 { margin: 0 0 8px; }
.footer p { color: var(--muted); }
.footer-nav { list-style: none; padding: 0; margin: 0; }
.footer-nav li { margin-bottom: 6px; }
.footer-nav a { color: var(--muted); text-decoration: none; display: inline-block; }
.footer-nav a:hover { color: var(--text); }
.copyright { margin-top: 12px; color: var(--muted); font-size: 12px; border-top: 1px solid #1f2937; padding-top: 12px; }
@media (max-width: 900px) { .footer-wrap { text-align: center; } .footer-nav { text-align: center; } .copyright { text-align: center; } }

/* Article page */
.article {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 22px; margin-top: 24px; box-shadow: var(--shadow);
}
.article h1 { margin-top: 0; font-size: 26px; }
.article h2 { margin-top: 24px; font-size: 22px; }
.article h3 { margin-top: 18px; font-size: 18px; }
.article p, .article li { color: var(--text); line-height: 1.6; }
.article blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--muted); }
.article pre { background: var(--panel-alt); padding: 12px; border-radius: 12px; overflow: auto; border: 1px solid var(--border); }
.article code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #cbd5e1; }
.article a { color: var(--accent); }

/* Списки в статьях: выравнивание отступов и маркеров */
.article ul, .article ol { margin: 12px 0; padding-left: 22px; list-style-position: outside; }
.article ul { list-style-type: disc; }
.article ol { list-style-type: decimal; }
.article li { margin: 6px 0; }

/* Мобильная читабельность контейнера */
@media (max-width: 620px) { .container { padding: 16px; } }

/* Interactive components */
.widget {
  margin-top: 24px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); padding: 16px; box-shadow: var(--shadow);
}
.widget h3 { margin: 0 0 8px; }
.widget .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 620px) { .widget .row { grid-template-columns: 1fr; } }
.widget input, .widget select {
  width: 100%; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-alt); color: var(--text);
}
.widget .result { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--panel-alt); border: 1px solid var(--border); }
.checklist { list-style: none; padding: 0; }
.checklist { list-style: none; padding: 0; margin: 12px 0; }
.checklist li { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.checklist li input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; width: auto; height: auto; padding: 0; }
.checklist li span { display: block; line-height: 1.6; }
.progress {
  margin-top: 10px; height: 10px; background: var(--panel-alt); border-radius: 12px; overflow: hidden; border: 1px solid var(--border);
}
.progress > span { display: block; height: 100%; width: 0; background: var(--success); transition: width .3s ease; }

/* Инфографика: KPI Grid */
.infograph .kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .infograph .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .infograph .kpi-grid { grid-template-columns: 1fr; } }
.kpi {
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 12px; padding: 14px;
}
.kpi .value { font-size: 22px; font-weight: 700; letter-spacing: .3px; }
.kpi .label { color: var(--muted); margin-top: 6px; }

/* Инфографика: Bar Compare */
.bar-compare .bars { display: grid; grid-template-columns: 1fr; gap: 10px; }
.bar-compare .bar-label { color: var(--muted); margin-bottom: 6px; }
.bar-compare .bar-track { height: 14px; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.bar-compare .bar-track > span { display: block; height: 100%; background: var(--accent); }
.bar-compare .bar-value { margin-top: 6px; color: var(--text); font-size: 14px; }

/* Инфографика: Timeline */
.timeline .timeline-list { list-style: none; padding: 0; margin: 0; }
.timeline .timeline-list li {
  position: relative; padding-left: 30px; margin: 10px 0; display: flex; align-items: center; gap: 8px;
}
.timeline .timeline-list li::before {
  content: ""; position: absolute; left: 8px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary);
}
.timeline .timeline-list li .step {
  display: inline-block; min-width: 22px; height: 22px; border-radius: 999px; background: var(--panel-alt); border: 1px solid var(--border); text-align: center; line-height: 22px; font-size: 12px; color: var(--text);
}
.timeline .timeline-list li .text { color: var(--text); }

/* Квиз */
.quiz .quiz-body { display: grid; gap: 12px; }
.quiz .question { background: var(--panel-alt); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.quiz .q-text { font-weight: 600; margin-bottom: 8px; }
.quiz .options label { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.quiz .options input { width: auto; }
.quiz .explain { margin-top: 6px; color: var(--muted); }
.quiz .quiz-actions { display: flex; align-items: center; gap: 10px; }
.quiz .quiz-result { color: var(--text); font-weight: 600; }

/* Категории (chips) */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.chip { appearance: none; border: 1px solid var(--border); background: var(--panel-alt); color: var(--text); border-radius: 999px; padding: 8px 12px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .2s ease; box-shadow: var(--shadow-sm); }
.chip .count { display: inline-block; min-width: 22px; height: 22px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); color: var(--muted); font-size: 12px; line-height: 22px; text-align: center; }
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--primary); }
.chip.active { border-color: var(--primary); color: var(--primary); }

/* FAQ (аккордеон) */
.faq #faq-list { display: grid; gap: 10px; }
.faq-item { border: 1px solid var(--border); border-radius: 12px; background: var(--panel-alt); overflow: hidden; }
.faq-question { width: 100%; text-align: left; padding: 12px 14px; background: transparent; color: var(--text); cursor: pointer; font-weight: 600; }
.faq-answer { padding: 0 14px 14px; color: var(--muted); border-top: 1px dashed var(--border); transition: max-height .2s ease; max-height: 0; }
