/* BottomNav — нижняя навигация (capsule) с sliding-pill индикатором активной вкладки. */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: 280px; max-width: calc(100vw - 32px);
  display: flex;
  background: rgba(10, 13, 20, 0.55);
  border: 1px solid var(--border);
  border-radius: 100px;
  -webkit-backdrop-filter: var(--blur-strong);
          backdrop-filter: var(--blur-strong);
  padding: 6px;
  z-index: var(--z-overlay);
  gap: 4px;
  box-shadow: var(--shadow-capsule);
  transition: width 0.32s cubic-bezier(.4, .0, .2, 1);
}
/* Offline: «найти» сжимается в ноль, контейнер уменьшается → центрируется. */
.bottom-nav[data-offline="true"] {
  width: 200px;
}

/* Sliding pill — фон активной вкладки, плавно «переезжает» при смене. */
.bottom-nav::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: var(--pill-w, calc((100% - 12px - 8px) / 3));
  height: calc(100% - 12px);
  background: var(--surface-hover);
  border-radius: 100px;
  transform: translateX(var(--pill-x, 0));
  transition: transform 0.36s cubic-bezier(.4, .0, .2, 1),
              width 0.32s cubic-bezier(.4, .0, .2, 1);
  z-index: 0;
  pointer-events: none;
}
/* JS временно включает .no-anim чтобы мгновенно поставить pill на позицию
   предыдущей вкладки (из sessionStorage) перед start'ом анимации. */
.bottom-nav.no-anim::before { transition: none !important; }

.bn-tab {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: 7px 4px;
  border-radius: 100px;
  text-decoration: none; color: var(--muted);
  font-size: var(--fs-xs);
  position: relative;
  z-index: 1;
  transition: color var(--t-quick),
              transform 0.26s cubic-bezier(.4, .0, .2, 1),
              flex 0.32s cubic-bezier(.4, .0, .2, 1),
              max-width 0.32s cubic-bezier(.4, .0, .2, 1),
              padding 0.32s cubic-bezier(.4, .0, .2, 1),
              opacity 0.28s ease;
}
/* Offline: tab «найти» сжимается и затухает. Pill пересчитывается через
   getBoundingClientRect в BottomNav.js (после ResizeObserver triggered). */
.bottom-nav[data-offline="true"] .bn-tab[data-tab="search"] {
  flex: 0 0 0;
  max-width: 0;
  opacity: 0;
  padding-left: 0; padding-right: 0;
  pointer-events: none;
  overflow: hidden;
}
.bn-tab .bn-label {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.1;
}
/* Эмодзи невыбранных вкладок — ч/б, активная — цветная. */
.bn-tab .bn-emoji {
  font-size: 16px; line-height: 1.1;
  filter: grayscale(1);
  transition: filter var(--t-quick);
}
.bn-tab.active {
  color: var(--text);
  /* фон рисует .bottom-nav::before pill */
}
.bn-tab.active .bn-emoji { filter: none; }
.bn-tab:hover { color: var(--text); }

/* Pulse (общий для bottomNav и reactionsBar). */
.bn-tab.pulse { animation: basePulse 0.38s ease-out; }

@media (prefers-color-scheme: light) {
  .bottom-nav { background: rgba(255, 255, 255, 0.55); }
}
[data-theme="light"] .bottom-nav { background: rgba(255, 255, 255, 0.55); }

/* Лендинг: отступ снизу — только под bottom-nav (без resp. на reactions-bar). */
body.landing-page .app {
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}
