/* Единый шаблон. Акцентные цвета задаются из config через CSS-переменные */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --accent: #6d5cff;
  --accent-2: #a78bfa;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #5a6478;
  --line: #e5e8f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
}
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.65; font-size: 16px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 18px; }

/* Шапка */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.head-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--text); }
.logo.light { color: #fff; }
.logo:hover { text-decoration: none; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; color: #fff; font-size: 13px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex: 0 0 auto;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 9px; font-weight: 600; font-size: 15px; }
.nav a:hover { color: var(--text); background: #eef0f6; text-decoration: none; }

/* Хлебные крошки */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 16px 0 0; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs b { color: var(--text); font-weight: 600; }

/* Хиро */
.hero {
  margin: 26px 0 0; padding: 46px 40px; border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: var(--shadow);
}
.hero h1 { font-size: clamp(26px, 4.5vw, 40px); line-height: 1.2; letter-spacing: -.02em; }
.hero p { margin-top: 12px; max-width: 640px; font-size: 17px; opacity: .95; }
.hero-actions { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero.notfound { text-align: center; }
.hero.notfound p { margin-left: auto; margin-right: auto; }
.hero-actions.center { justify-content: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; font-weight: 700; font-size: 15px;
  border: none; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: #fff; color: var(--accent); }
.btn-ghost { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.45); }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
body .btn-accent { box-shadow: 0 6px 18px rgba(0,0,0,.12); }

/* Секции */
.section { margin-top: 38px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.sec-head h2 { font-size: 24px; letter-spacing: -.01em; }
.more { font-weight: 600; font-size: 14.5px; }
.page-h1 { font-size: clamp(24px, 3.6vw, 34px); letter-spacing: -.02em; margin-top: 22px; }
.page-sub { color: var(--muted); margin-top: 8px; max-width: 720px; }

/* Категории */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.cat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 6px; color: var(--text);
  transition: box-shadow .15s ease, transform .15s ease;
}
.cat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.cat-dot { width: 12px; height: 12px; border-radius: 4px; }
.cat-name { font-weight: 700; font-size: 14.5px; }
.cat-count { color: var(--muted); font-size: 13px; }

/* Карточки */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--text);
  transition: box-shadow .15s ease, transform .15s ease;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.card h3 { font-size: 17px; line-height: 1.35; }
.card p {
  color: var(--muted); font-size: 14px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-cat { color: var(--accent); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.card-meta { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 6px; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; color: #fff; font-weight: 800; font-size: 15px;
  flex: 0 0 auto;
}
.badge.big { width: 62px; height: 62px; font-size: 19px; border-radius: 16px; }
.chip {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  background: #eef0f6; color: var(--muted); font-size: 12.5px; font-weight: 700;
}
.rate { color: #b7791f; font-weight: 700; font-size: 13.5px; }

/* Фильтр и чипы категорий */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.chip-link {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-weight: 600; font-size: 13.5px;
}
.chip-link:hover { text-decoration: none; color: var(--text); }
.chip-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-input {
  width: 100%; max-width: 460px; margin: 14px 0 20px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: 12px; font-size: 15px; background: var(--card); color: var(--text);
}
.filter-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hidden { display: none !important; }

/* Новости */
.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-row {
  display: flex; gap: 18px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.news-row time { color: var(--muted); font-size: 13px; white-space: nowrap; padding-top: 3px; min-width: 110px; }
.news-row h3 { font-size: 16.5px; line-height: 1.4; }
.news-row h3 a { color: var(--text); }
.news-row h3 a:hover { color: var(--accent); }
.news-row p { color: var(--muted); font-size: 14px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-list.small .news-row { padding: 12px 14px; }
.src { color: var(--muted); font-size: 12.5px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 26px 0; color: var(--muted); font-size: 14px; }

/* Страница материала */
.item-page { max-width: 820px; margin: 0 auto; }
.item-head { display: flex; gap: 18px; align-items: flex-start; margin-top: 24px; }
.item-head h1 { font-size: clamp(24px, 3.4vw, 32px); line-height: 1.25; letter-spacing: -.02em; }
.item-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 10px; color: var(--muted); font-size: 13.5px; }
.item-meta a { color: var(--accent); font-weight: 600; }
.art-meta { margin-top: 24px; color: var(--muted); font-size: 13.5px; }
.item-page h1 { margin-top: 8px; }
.prose { margin-top: 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; }
.prose p { margin-bottom: 14px; }
.prose p:last-child { margin-bottom: 0; }
.prose h2 { font-size: 20px; margin: 22px 0 10px; }
.prose ul { margin: 0 0 14px 20px; }
.prose li { margin-bottom: 6px; }
.block { margin-top: 26px; }
.block h2 { font-size: 21px; margin-bottom: 14px; }
.feature-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.feature-list li {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14.5px;
}
.pc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 26px; }
.pc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.pc h3 { font-size: 16px; margin-bottom: 10px; }
.pc ul { margin-left: 18px; }
.pc li { margin-bottom: 6px; font-size: 14.5px; }
.pros h3 { color: #0f8a4d; }
.cons h3 { color: #d13c3c; }
.price-note { margin-top: 18px; color: var(--muted); font-size: 14.5px; }
.cta-row { margin-top: 22px; }
.see-also ul { margin-left: 18px; }
.see-also li { margin-bottom: 8px; }
.source-box {
  margin-top: 22px; padding: 14px 18px; border-radius: 12px;
  background: #eef0f6; color: var(--muted); font-size: 14.5px;
}

/* ── Реклама ─────────────────────────────────────────────── */
.ad { margin: 22px auto; text-align: center; overflow: hidden; }
.ad-real { line-height: 0; }
.ad-ph {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; min-height: 96px; padding: 20px 14px;
  border: 2px dashed #b9bed2; border-radius: 14px;
  background: repeating-linear-gradient(-45deg, #f3f4fa, #f3f4fa 14px, #eef0f8 14px, #eef0f8 28px);
  color: var(--muted); font-size: 13px;
}
.ad-badge {
  position: absolute; top: 10px; left: 10px;
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: .1em;
}
.ad-line { font-size: 14px; color: var(--text); }
.ad-line b { font-weight: 700; }
.ad-line i { font-style: normal; color: var(--muted); font-size: 12.5px; }
.ad-hint { font-size: 12px; opacity: .85; }
/* размеры позиций */
.ad-top, .ad-footer { max-width: 970px; }
.ad-header, .ad-endpage { max-width: 728px; }
.ad-inarticle, .ad-inarticle2 { max-width: 400px; min-height: 220px; margin-left: auto; margin-right: auto; }
.ad-infeed { min-height: 104px; }
.ad-sticky { min-height: 74px; margin: 0; }
.site-footer .ad-ph { border-color: #4b5473; background: repeating-linear-gradient(-45deg, #1c2133, #1c2133 14px, #202639 14px, #202639 28px); color: #aab2c8; }
.site-footer .ad-line { color: #e8ebf5; }
/* in-feed внутри сетки карточек — на всю ширину ряда */
.cards > .ad { grid-column: 1 / -1; align-self: center; width: 100%; }
.news-list > .ad { margin: 10px 0; }
/* липкий баннер внизу экрана */
.ad-sticky-wrap {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,.97); box-shadow: 0 -6px 24px rgba(20,25,40,.16);
}
.ad-sticky-wrap .ad { max-width: 1120px; margin: 0 auto; }
.ad-close {
  position: absolute; top: -11px; right: 14px; width: 26px; height: 26px;
  border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: 13px; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
}
.ad-close:hover { color: var(--text); }
body.has-sticky-ad { padding-bottom: 118px; }
@media (max-width: 720px) {
  .ad-top, .ad-header, .ad-infeed, .ad-endpage, .ad-footer { min-height: 84px; }
  .ad-inarticle, .ad-inarticle2 { min-height: 190px; }
  body.has-sticky-ad { padding-bottom: 130px; }
}

/* Подвал */
.site-footer { margin-top: 60px; background: #171c2b; color: #c7cddb; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; padding: 38px 18px 26px; }
.foot-grid h4 { color: #fff; font-size: 15px; margin-bottom: 12px; }
.foot-grid a { display: block; color: #c7cddb; margin-bottom: 8px; font-size: 14px; }
.foot-grid a:hover { color: #fff; }
.foot-about { margin-top: 12px; font-size: 13.5px; max-width: 380px; opacity: .85; }
.foot-bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 16px 18px; font-size: 13px; opacity: .75; }

/* Админка */
.admin-login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.admin-login {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 34px 30px;
  width: 360px; max-width: 92vw; box-shadow: var(--shadow); text-align: center;
}
.admin-login h1 { font-size: 20px; }
.admin-login p { color: var(--muted); margin: 8px 0 18px; }
.admin-login input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; font-size: 15px;
}
.admin-login .err { color: #d13c3c; }
.admin-wrap { max-width: 860px; margin: 30px auto; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin: 20px 0; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.stat b { font-size: 26px; display: block; }
.stat span { color: var(--muted); font-size: 13px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-top: 18px; }
.panel h2 { font-size: 18px; margin-bottom: 12px; }
.panel ul { margin-left: 18px; }
.ok-text { color: #0f8a4d; }
.err-text { color: #d13c3c; }

@media (max-width: 720px) {
  .hero { padding: 32px 22px; border-radius: 18px; }
  .foot-grid { grid-template-columns: 1fr; gap: 22px; }
  .news-row { flex-direction: column; gap: 4px; }
  .pc-grid { grid-template-columns: 1fr; }
  .prose { padding: 20px 18px; }
}
