/* Основные стили темы default. Цвета/шрифты — в variables.css */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: clip; } /* мобильный люфт: страница никогда не шире экрана */
html { font-size: var(--fs-base); }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.55; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gap); }

/* ---------- Шапка ---------- */
.site-header { background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: var(--gap); height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; color: var(--brand); }
.logo:hover { text-decoration: none; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 21px; }
.header-search { flex: 1; display: flex; max-width: 480px; }
.header-search input { flex: 1; height: 38px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--bg); color: var(--text); font-size: var(--fs-sm); outline: none; }
.header-search input:focus { border-color: var(--brand); }
.header-search button { height: 38px; padding: 0 14px; border: 1px solid var(--border); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--bg); cursor: pointer; }
.header-nav { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.header-user { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: var(--fs-sm); }
.theme-toggle { border: 1px solid var(--border); background: var(--bg); color: var(--text-soft); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 16px; }

.site-subnav { background: var(--bg-card); border-bottom: 1px solid var(--border); }
.subnav-inner { display: flex; gap: 22px; height: 42px; align-items: center; overflow-x: auto; }
.subnav-inner a { color: var(--text-soft); font-size: var(--fs-sm); white-space: nowrap; }
.subnav-inner a:hover { color: var(--brand); text-decoration: none; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-soft); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-lg { height: 46px; padding: 0 26px; font-size: 15px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: var(--fs-xs); }

/* ---------- Разметка ---------- */
.main { padding: calc(var(--gap) * 1.5) var(--gap); min-height: 60vh; }
.layout-two-col { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: calc(var(--gap) * 1.5); }
.col-side { min-width: 0; }
h1 { font-size: var(--fs-h1); margin-bottom: var(--gap); line-height: 1.3; }
h2 { font-size: var(--fs-h2); }
.page-sub { color: var(--text-soft); margin: -8px 0 var(--gap); }

/* ---------- Хлебные крошки ---------- */
.breadcrumbs { font-size: var(--fs-xs); color: var(--text-faint); margin-bottom: var(--gap); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumbs a { color: var(--text-soft); }
.crumb-current { color: var(--text-faint); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Карточки вопросов ---------- */
.section { margin-bottom: calc(var(--gap) * 2); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-more { font-size: var(--fs-sm); }
.question-list { display: flex; flex-direction: column; gap: 10px; }
.question-card { display: flex; gap: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.question-card:hover { border-color: var(--brand); }
.question-card-stats { flex-shrink: 0; }
.stat { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 58px; height: 52px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text-soft); }
.stat-num { font-weight: 700; font-size: 17px; }
.stat-label { font-size: 10.5px; }
.stat-answered { border-color: var(--brand); color: var(--brand); }
.stat-best { background: var(--accent-best); border-color: var(--accent-best); color: #fff; }
.question-card-title { font-size: 16px; font-weight: 600; line-height: 1.35; }
.question-card-title a { color: var(--text); }
.question-card-title a:hover { color: var(--brand); text-decoration: none; }
.question-card-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; font-size: var(--fs-xs); color: var(--text-faint); }
.meta-category { color: var(--brand); background: var(--brand-soft); padding: 1px 8px; border-radius: 20px; }

/* ---------- Страница вопроса ---------- */
.question-full { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: var(--gap); }
.question-title { margin-bottom: 10px; }
.question-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: var(--fs-xs); color: var(--text-faint); margin-bottom: 12px; }
.question-body { margin: 14px 0; }
.question-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag { font-size: var(--fs-xs); color: var(--text-soft); background: var(--bg-hover); border: 1px solid var(--border); padding: 3px 10px; border-radius: 20px; }
.tag:hover { color: var(--brand); border-color: var(--brand); text-decoration: none; }

.answers-title { margin: calc(var(--gap) * 1.4) 0 12px; }
.answer { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px; box-shadow: var(--shadow); }
.answer-best { border-color: var(--accent-best); background: var(--accent-best-soft); }
.best-ribbon { color: var(--accent-best); font-weight: 700; font-size: var(--fs-xs); margin-bottom: 8px; }
.answer-head { display: flex; align-items: center; gap: 12px; font-size: var(--fs-xs); color: var(--text-faint); margin-bottom: 8px; flex-wrap: wrap; }
.answer-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.like-btn, .like-static { border: 1px solid var(--border); background: transparent; color: var(--text-soft); border-radius: 20px; padding: 3px 12px; font-size: var(--fs-xs); cursor: pointer; }
.like-btn:hover { border-color: var(--brand); color: var(--brand); }
.answer-form-block { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-top: var(--gap); }
.answer-form-block h2 { margin-bottom: 10px; }
.answer-form-block textarea { width: 100%; margin-bottom: 10px; }

/* ---------- Пользователи ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--avatar-bg, var(--brand)); color: #fff; font-weight: 700; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 74px; height: 74px; font-size: 26px; }
.user-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-size: var(--fs-sm); }
.user-badge:hover { text-decoration: none; }
.user-badge-name { font-weight: 600; }
.rank-badge { font-size: 11px; color: var(--rank-color, var(--text-soft)); border: 1px solid var(--rank-color, var(--border)); padding: 1px 8px; border-radius: 20px; white-space: nowrap; }
.rank-badge-lg { font-size: var(--fs-sm); padding: 3px 12px; }
.profile-head { display: flex; gap: 18px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: var(--gap); }
.profile-stats { display: flex; flex-wrap: wrap; gap: 16px; margin: 10px 0 4px; font-size: var(--fs-sm); color: var(--text-soft); }
.profile-since { font-size: var(--fs-xs); color: var(--text-faint); }
.profile-about { margin-top: 10px; color: var(--text-soft); }
.profile-answer { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.profile-answer p { color: var(--text-soft); font-size: var(--fs-sm); margin: 6px 0; }
.profile-answer time { font-size: var(--fs-xs); color: var(--text-faint); }
.best-mark { color: var(--accent-best); font-size: var(--fs-xs); font-weight: 700; margin-left: 8px; }

/* ---------- Сайдбар ---------- */
.side-block { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: var(--gap); box-shadow: var(--shadow); }
.side-block h3 { font-size: var(--fs-h3); margin-bottom: 10px; }
.category-list { list-style: none; }
.category-list a { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; color: var(--text-soft); font-size: var(--fs-sm); }
.category-list a:hover { color: var(--brand); text-decoration: none; }
.count { color: var(--text-faint); font-size: var(--fs-xs); }
.side-links { list-style: none; }
.side-links li { padding: 5px 0; border-bottom: 1px dashed var(--border); }
.side-links li:last-child { border-bottom: 0; }
.side-links a { font-size: var(--fs-sm); color: var(--text-soft); }
.side-links a:hover { color: var(--brand); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }

/* ---------- Категории ---------- */
.categories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap); }
.category-tile { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.category-tile h2 { font-size: 17px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; }
.category-tile h2 a { color: var(--text); }
.category-tile-children { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.category-tile-children a { font-size: var(--fs-xs); color: var(--text-soft); }
.subcategory-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--gap); }
.chip { display: inline-flex; gap: 6px; align-items: center; background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; padding: 5px 14px; font-size: var(--fs-sm); color: var(--text-soft); }
.chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* ---------- Прочее ---------- */
.hero { text-align: center; padding: 28px 0 34px; }
.hero-title { font-size: 28px; margin-bottom: 16px; }
.sort-tabs { display: flex; gap: 6px; margin-bottom: var(--gap); border-bottom: 1px solid var(--border); }
.sort-tab { padding: 8px 16px; color: var(--text-soft); font-size: var(--fs-sm); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sort-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.sort-tab:hover { text-decoration: none; color: var(--brand); }
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: calc(var(--gap) * 1.5) 0; }
.page-link { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-soft); font-size: var(--fs-sm); padding: 0 8px; }
.page-link:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.page-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-ellipsis { align-self: center; color: var(--text-faint); }
.empty { color: var(--text-faint); padding: 22px; text-align: center; background: var(--bg-card); border: 1px dashed var(--border); border-radius: var(--radius); }
.messages { margin-bottom: var(--gap); }
.message { padding: 12px 16px; border-radius: var(--radius-sm); font-size: var(--fs-sm); margin-bottom: 8px; background: var(--brand-soft); color: var(--brand); }
.message-success { background: var(--accent-best-soft); color: var(--accent-best); }
.message-warning { background: #fdf6e3; color: #8a6d1a; }
.message-error { background: #fdecec; color: var(--accent-error); }
:root[data-theme="dark"] .message-warning { background: #2b2413; }
:root[data-theme="dark"] .message-error { background: #2d1717; }

/* ---------- Формы ---------- */
.form-page { max-width: 720px; }
.form-page-narrow { max-width: 420px; margin: 0 auto; }
.form label { display: block; font-size: var(--fs-sm); font-weight: 600; margin: 14px 0 5px; }
.form input[type=text], .form input[type=search], .form input[type=email], .form input[type=password],
.form select, .form textarea, .search-page-form input, .answer-form-block textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text); font-family: var(--font); font-size: var(--fs-sm); outline: none;
}
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--brand); }
.form button { margin-top: 18px; }
.form-hint { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 4px; }
.form-alt { margin-top: 16px; font-size: var(--fs-sm); color: var(--text-soft); }
.form .errorlist { list-style: none; color: var(--accent-error); font-size: var(--fs-xs); margin-top: 4px; }
.search-page-form { display: flex; gap: 10px; margin-bottom: var(--gap); max-width: 620px; }
.category-cascade { display: flex; flex-direction: column; gap: 8px; }
.logout-form { margin-top: 22px; }

/* ---------- Подвал ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-card); margin-top: 40px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap); padding: 20px var(--gap); font-size: var(--fs-xs); color: var(--text-faint); }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.footer-links a { color: var(--text-soft); }
.lang-switcher { margin-left: auto; }
.lang-switcher select { padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text-soft); }

/* ---------- Адаптивность ---------- */
@media (max-width: 960px) {
  .layout-two-col { grid-template-columns: 1fr; }
  .col-side { order: 2; }
}
@media (max-width: 720px) {
  :root { --fs-h1: 21px; --fs-h2: 18px; }
  .header-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; row-gap: 10px; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; }
  .header-username { display: none; }
  .btn-ask { padding: 0 12px; }
  .question-card { padding: 12px; gap: 10px; }
  .stat { width: 48px; height: 46px; }
  .profile-head { flex-direction: column; align-items: flex-start; }
  .hero { padding: 16px 0 22px; }
  .hero-title { font-size: 22px; }
}

/* --- Голосование за ответы: 👍 / 👎 --- */
.vote-group { display: inline-flex; gap: 6px; }
.vote-btn.voted { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.vote-btn.vote-down.voted { border-color: var(--accent-error); color: var(--accent-error); background: transparent; }

/* Флаги стран (SVG вместо эмодзи - Windows не показывает эмодзи-флаги) */
.flag-icon { width: 1.15em; height: .85em; object-fit: cover; border-radius: 2px; vertical-align: -0.08em; display: inline-block; }

/* OAuth-кнопки на входе/регистрации */
.social-login { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.social-divider { text-align: center; color: var(--text-faint); font-size: var(--fs-xs); margin-bottom: 2px; }
.social-btn { width: 100%; }

/* Подфильтры блока "Популярные" (период и критерий) */
.sort-tabs-sub { margin-top: -6px; }
.sort-tabs-sub .sort-tab { font-size: var(--fs-xs); padding: 4px 10px; white-space: nowrap; }

/* Картинки-аватарки (у части ботов; отключаются в админке) */
.avatar-img { object-fit: cover; border-radius: 50%; }

/* Загрузка аватарки в настройках профиля */
.avatar-edit { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.avatar-edit-controls { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.avatar-edit-controls input[type="file"] { font-size: var(--fs-xs); max-width: 100%; }
.checkbox-line { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.hint { color: var(--text-faint); font-size: var(--fs-xs); }

/* Ссылка на настройки в собственном профиле */
.profile-edit-link { margin-top: 10px; display: inline-flex; align-items: center; }

/* Лента "Последние ответы" */
.answer-feed { display: flex; flex-direction: column; gap: 12px; }
.answer-feed-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.answer-feed-question { font-weight: 600; color: var(--brand); display: block; margin-bottom: 6px; }
.answer-feed-body { color: var(--text-soft); font-size: var(--fs-sm); margin: 0 0 10px; }
.answer-feed-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-faint); }
.answer-feed-best { color: #2f9e44; font-weight: 600; }

/* Счётчики вопросов/ответов на главной */
.hero-stats { color: var(--text-soft); font-size: var(--fs-sm); margin: 6px 0 14px; }
.hero-stats b { color: var(--brand); }

/* Реплики под ответами (диалог автора с отвечавшими) */
.answer-comments { margin-top: 10px; padding: 8px 12px; border-left: 3px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.answer-comment { font-size: var(--fs-sm); line-height: 1.45; }
.comment-author { font-weight: 600; margin-right: 6px; }
.comment-op { color: var(--brand); font-size: var(--fs-xs); font-weight: 400; }
.comment-time { color: var(--text-faint); font-size: var(--fs-xs); margin-left: 8px; }
.comment-form { display: flex; gap: 6px; margin-top: 4px; }
.comment-form input { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }

/* Кнопка «Подобрать категорию» */
.suggest-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; flex-wrap: wrap; }
#suggest-status { margin: 0; }

/* Логотип-знак Askeno (SVG вместо символа «?») */
.logo-mark.logo-mark--svg { background: transparent; border-radius: 0; color: var(--brand); padding: 0; }
.logo-mark.logo-mark--svg svg { width: 100%; height: 100%; display: block; }

/* Шрифт логотипа: Manrope SemiBold (как в фирменном знаке; латинский сабсет, self-hosted) */
@font-face {
  font-family: "Manrope";
  src: url("/static/common/fonts/manrope-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
.logo-text { font-family: "Manrope", var(--font); font-weight: 600; letter-spacing: -.01em; }

/* --- обращения: статические страницы, формы, жалобы --- */
.static-page h2 { margin: 22px 0 8px; font-size: 1.1em; }
.static-page p { margin: 8px 0; line-height: 1.55; }
.flash { padding: 12px 14px; border-radius: 8px; margin: 14px 0; border: 1px solid var(--brand); background: var(--brand-soft); }
.flash-error { border-color: var(--accent-error, #c33); background: transparent; color: var(--accent-error, #c33); }
.hp-field { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.report-link { color: var(--text-faint); font-size: var(--fs-xs); text-decoration: none; }
.report-link:hover { color: var(--accent-error, #c33); }

/* --- подсказка языка (язык браузера != язык страницы) --- */
.lang-suggest { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; text-align: center; gap: 10px 14px; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 14px 18px; width: max-content; max-width: calc(100vw - 24px); font-size: var(--fs-sm); }
.lang-suggest-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* --- мобильные отступы: до текста ~20px вместо ~39px --- */
@media (max-width: 600px) {
  .main { padding-left: 8px; padding-right: 8px; }
  .question-full { padding: 16px 12px; }
  .answer { padding: 14px 12px; }
  .question-card { padding: 12px 10px; gap: 10px; }
  .answer-form-block { padding: 14px 12px; }
  .side-block { padding-left: 12px; padding-right: 12px; }
}
