/* Экран «Главная»: WelcomeHero Flarum, доска разделов NodeBB Harmony
   (categories.tpl, partials/categories/item.tpl и lastpost.tpl, MIT),
   виджеты правой колонки, последние обсуждения — поверх фундамента style.css.
   Строки .thr стилизует экран обсуждений. */

/* ================================ Hero ==================================== */
/* Одна приглушённая строка: адрес · статус · версия · сезон (· Discord гостю) */
.home-hero__meta {
  align-items: center;
  gap: 4px 0;
  margin-top: 15px;
  color: var(--hero-color);
  line-height: 20px;
}
.home-hero__item { display: inline-flex; align-items: center; gap: 6px; }
.home-hero__item::before {
  content: "·";
  margin: 0 4px 0 10px;
  color: var(--muted-more-color);
}
.home-hero__season { display: inline-block; }
.home-hero__meta .srv__ip { min-height: 30px; padding: 4px 10px; margin-right: 4px; }
.home-hero__meta .srv__ip + .home-hero__item::before { content: none; }
.home-hero__status b { color: var(--text-color); font-variant-numeric: tabular-nums; }
.home-hero__status b:empty { display: none; }
.home-hero__season .countdown { color: var(--text-color); font-variant-numeric: tabular-nums; }
.home-hero__link { color: var(--link-color); }
.home-hero__link:hover { text-decoration: underline; }
.home-hero__link .ic { width: 14px; height: 14px; }
/* В hero фон control-bg — кнопке адреса нужен контраст тоном */
.home-hero .srv__ip { background: var(--body-bg); }
.home-hero .srv__ip:hover,
.home-hero .srv__ip:focus-visible { background: var(--body-bg-shaded); }

/* ============ Каркас: широкая доска + узкая колонка (categories.tpl) ======= */
/* Ширину колонки виджетов задаёт экран; отступ между колонками — фундамент (40px от 1100px) */
.home { --aside-width: 270px; }

/* «Начать тему»: в колонке справа на широких экранах, над доской — на узких */
.home__bar { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.home-widgets__start.btn { display: none; }
@media (min-width: 1100px) {
  .home__bar { display: none; }
  .home-widgets__start.btn { display: flex; margin-bottom: 30px; }
}
@media (max-width: 767.98px) {
  .home__bar { margin-bottom: 15px; }
  .home__start.btn { flex: 1 1 auto; justify-content: center; }
}

/* Статистика одной строкой в конце колонки */
.home-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 0;
  margin: 30px 0 0;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: var(--muted-color);
  font-variant-numeric: tabular-nums;
}
.home-stats > span + span::before {
  content: "·";
  margin: 0 6px;
  color: var(--muted-more-color);
}
.home-stats a { color: var(--text-color); font-weight: 600; }
.home-stats a:hover { color: var(--link-color); text-decoration: underline; }


/* ===================== Доска разделов (Harmony categories) ================= */
.board { container: board / inline-size; }
.board + .board { margin-top: 40px; }

.board__hd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}
.board__name {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: 400;
  line-height: 1.3;
  color: var(--heading-color);
}
.board__descr {
  flex-basis: 100%;
  order: 2;
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--muted-color);
}
.board__more {
  margin-left: auto;
  font-size: 13px;
  color: var(--link-color);
}
.board__more:hover { text-decoration: underline; }

.board__list { margin: 0; padding: 0; list-style: none; }

/* partials/categories/item.tpl */
.board__item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
}
.board__item:last-child { border-bottom: 0; }

.board__main { display: flex; gap: 12px; min-width: 0; }

/* buildCategoryIcon(40px, rounded-1) */
.board__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius);
  background: var(--forum-color, var(--control-bg));
  color: var(--contrast-color, var(--text-color));
}
.board__icon .ic { width: 20px; height: 20px; }


.board__body {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}
.board__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  width: 100%;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.board__title > a { color: var(--heading-color); }
.board__title > a:hover { color: var(--link-color); }
.board__lock { display: inline-flex; color: var(--muted-color); }
.board__text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  width: 100%;
  max-width: 62ch;
  margin: 0;
  font-size: var(--font-size);
  line-height: 1.45;
  color: var(--muted-color);
}

/* Счётчики под описанием на узких экранах (d-lg-none) */
/* Одна приглушённая строка без плашек: «1 тема · 10 сообщений · 13 июня» */
.board__mstats {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  margin: 2px 0 0;
  font-size: var(--font-size-sm);
  line-height: 1.4;
  color: var(--muted-color);
  font-variant-numeric: tabular-nums;
}
.board__mstats > * + *::before {
  content: "·";
  margin: 0 6px;
  color: var(--muted-more-color);
}
.board__mlast { color: inherit; }
.board__mlast:hover { color: var(--link-color); }

.board__side { display: none; min-width: 0; }
.board__stats { display: none; }

/* Два серых блока-счётчика «темы / сообщения» */
.board__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 8px 4px;
  overflow: hidden;
  border-radius: var(--border-radius);
  background: var(--control-bg);
  color: var(--muted-color);
}
.board__num {
  font-size: 18px;
  line-height: 1;
  color: var(--text-color);
  font-variant-numeric: tabular-nums;
}
.board__lbl { margin-top: 5px; font-size: var(--font-size-sm); line-height: 1.2; }

/* partials/categories/lastpost.tpl — левая полоска цвета раздела */
.board__teaser { flex: 1 1 auto; min-width: 0; }
.board__last {
  display: flex;
  flex-direction: column;
  gap: 3px;
  height: 100%;
  padding-left: 8px;
  border-left: 2px solid var(--forum-color, var(--border-color));
  font-size: var(--font-size-sm);
  line-height: 1.35;
}
.board__last-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  color: var(--muted-color);
}
.board__last-meta > span { overflow: hidden; text-overflow: ellipsis; }
.board__last-user { display: inline-flex; flex-shrink: 0; border-radius: 50%; }
.board__last-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--text-color);
  overflow-wrap: anywhere;
}
.board__last-title:hover { color: var(--link-color); }
.board__last-empty { color: var(--muted-color); }

/* Широкая доска (col-lg-7 / col-lg-5): иконка+название | счётчики | тизер */
@container board (min-width: 600px) {
  .board__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 410px);
    gap: 15px;
    align-items: start;
    padding: 18px 0;
  }
  .board__mstats { display: none; }
  .board__side { display: flex; align-self: stretch; }
  .board__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    flex: 0 0 176px;
    padding-right: 12px;
  }
}

body.compact .board__item { padding-block: 10px; }

/* ========================= Последние обсуждения =========================== */
.home-latest { margin-top: 40px; }
.home-latest__list { margin-top: 5px; }

/* ================== Виджеты правой колонки (Harmony sidebar) ============== */
.widget + .widget { margin-top: 30px; }
.widget__title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  font-size: var(--font-size-md);
  font-weight: 600;
  line-height: 1.4;
  color: var(--heading-color);
}
.widget__count { font-weight: 400; color: var(--muted-color); font-variant-numeric: tabular-nums; }
.widget__more {
  margin-left: auto;
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--link-color);
}
.widget__more:hover { text-decoration: underline; }
.widget__note,
.widget__empty {
  margin: 10px 0 0;
  font-size: var(--font-size-sm);
  color: var(--muted-color);
}
.widget__empty { margin-top: 0; }

/* Сейчас онлайн */
.w-online {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.w-online a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.w-online a:hover span { text-decoration: underline; }

/* Мини-чат */
/* Обычный список последних сообщений, без вложенной прокрутки:
   app.js перерисовывает до 12 штук — показываем 6 последних */
.shout {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shout__msg:nth-last-child(n+7) { display: none; }
.shout__msg {
  display: flex;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-color);
  overflow-wrap: anywhere;
}
.shout__msg > div { min-width: 0; }
.shout__msg b { font-weight: 600; }
.shout__msg .t { margin-left: 4px; font-size: var(--font-size-xs); color: var(--muted-more-color); }
.shout__form { display: flex; gap: 5px; margin-top: 12px; }
.shout__form .inp { flex: 1 1 auto; min-width: 0; }
.shout__form .btn { flex-shrink: 0; }

/* Списки: топ, команда */
.w-list { margin: 0; padding: 0; list-style: none; }
.w-list > li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  min-width: 0;
}
.w-list__tx { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.35; }
.w-list__tx a {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.w-list__tx a:hover { text-decoration: underline; }
.w-list__tx span {
  overflow: hidden;
  font-size: var(--font-size-sm);
  color: var(--muted-color);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.w-top__n {
  width: 14px;
  flex-shrink: 0;
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--muted-more-color);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.w-top__ap {
  flex-shrink: 0;
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--muted-color);
  font-variant-numeric: tabular-nums;
}

/* Колонка виджетов под контентом (< 1100px): две колонки, пока хватает места */
@media (min-width: 768px) and (max-width: 1099.98px) {
  .home-widgets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px 40px;
    margin-top: 40px;
  }
  .home-widgets .widget + .widget { margin-top: 0; }
  .home-stats { grid-column: 1 / -1; margin-top: 0; }
}
@media (max-width: 767.98px) {
  /* Телефон: без разделителей в начале перенесённых строк —
     адрес и статус первой строкой, сезон второй */
  .home-hero__meta { gap: 6px 12px; }
  .home-hero__item::before { content: none; }
  .home-hero__meta .srv__ip { margin-right: 0; }
  .home-hero__ver,
  .home-hero__link { display: none; }
  .home-widgets .widget--wide { display: none; }
  .home-stats { margin-top: 30px; }
  /* Короче страница: плотнее строки доски, пять последних обсуждений */
  .board + .board { margin-top: 30px; }
  .board__item { padding: 12px 0; }
  .board__text { font-size: var(--font-size-sm); line-height: 1.4; }
  .home-latest__list > :nth-child(n+6) { display: none; }
  .home-latest { margin-top: 30px; }
  .page__aside.home-widgets { margin-top: 40px; }
}

/* Сенсорные экраны — цели не меньше 44px */
@media (pointer: coarse) {
  .widget__more,
  .board__more { display: inline-flex; align-items: center; min-height: 44px; margin-block: -12px; }
  .w-online a { min-height: 44px; }
  .w-list > li { min-height: 44px; }
  .board__title > a { display: inline-flex; align-items: center; min-height: 44px; margin-block: -10px; }
}
