/* Переключение видимости по языкам */
html.lang-ru [data-lang="ro"] { display: none !important; }
html.lang-ro [data-lang="ru"] { display: none !important; }

/* Шапка с фоном и логотипом */
.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  color: #f9fafb;
  overflow: hidden;

  background-image:
    linear-gradient(135deg, rgba(15,23,42,0.90), rgba(15,23,42,0.80)),
    url("/assets/images/napoleonic_wars.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Ссылка-логотип (флаг + текст) */
.logo-block {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.logo-image {
  width: 40px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.6);
}

.logo-title h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Переключатель языков */
.lang-switcher {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lang-switcher button {
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(15,23,42,0.25);
  color: inherit;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* Подсветка активного языка — по классу на <html> */
html.lang-ru .lang-switcher button[data-set-lang="ru"],
html.lang-ro .lang-switcher button[data-set-lang="ro"] {
  background: #f9fafb;
  color: #0f172a;
  border-color: #f9fafb;
}

/* Hover */
.lang-switcher button:hover {
  background: rgba(249,250,251,0.12);
}

/* Подвал */
.site-footer{
  margin-top:24px;
  padding:24px 16px;
  background:linear-gradient(180deg, rgba(13,20,34,0.98) 0%, rgba(9,14,24,0.98) 100%);
  color:rgba(255,255,255,0.86);
  border-top:1px solid rgba(255,255,255,0.08);
}

.site-footer .footer-inner{
  max-width:1100px;
  margin:0 auto;
  text-align:center;
}

.site-footer .footer-title{
  font-weight:800;
  font-size:16px;
  margin-bottom:6px;
}

.site-footer .footer-subtitle{
  font-size:13px;
  opacity:0.9;
  margin-bottom:10px;
}

.site-footer .footer-note{
  font-size:12px;
  opacity:0.75;
}

/* Большая картинка на главной */
.hero-image{
  width:100%;
  max-height:320px;
  object-fit:cover;
  border-radius:18px;
  display:block;
}

.index-content{
  max-width:980px;
  margin-top:1.75rem;
}

/* Картинка в статье справа */
.article-image-right {
  margin-bottom: 15px;
}

.article-image-right img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

/* ПК: картинка справа с обтеканием */
@media (min-width: 900px) {
  .article-image-right {
    float: right;
    max-width: 50%;
    margin-left: 20px;
    margin-bottom: 10px;
  }
}

/* Мобилка: картинка сверху */
@media (max-width: 899px) {
  .article-image-right {
    float: none;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .article-image-right img {
    width: 100%;
  }
}

.article-image-right figcaption {
    text-align: center;
    font-style: italic;
}

/* Заголовок и подзаголовок на главной */
.index-title {
  text-align: center;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.index-subtitle {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: #4b5563;
}

/* Текст на главной — по обеим краям */
.index-content p {
  text-align: justify;
}

/* Подсветка активного пункта оглавления */
.toc li.toc-current {
  background-color: rgba(17, 24, 39, 0.06);
  border-radius: 10px;
  padding: 2px 16px;
}

.toc li.toc-current > a {
  font-weight: 700;
}


/* Горизонтальный таймлайн под шапкой */
.timeline-bar {
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.4rem 0 0.6rem;
}

.timeline-scroll {
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  -webkit-overflow-scrolling: touch;
  user-select: none;
}

/* Скрываем стандартные скроллбары */
.timeline-scroll::-webkit-scrollbar {
  display: none;
}
.timeline-scroll {
  scrollbar-width: none;
}

/* Картинка таймлайна — шире экрана */
.timeline-image {
  display: block;
  max-height: 180px;
  height: auto;
  max-width: none;
  -webkit-user-drag: none;
  user-drag: none;
}

/* ПК: повыше таймлайн */
@media (min-width: 900px) {
  .timeline-image {
    max-height: 235px;
  }
}

/* Состояние перетаскивания */
.timeline-scroll.is-dragging {
  cursor: grabbing;
}


/* Оверлей для увеличенного таймлайна */
.timeline-zoom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.timeline-zoom-overlay.is-visible {
  display: flex;
}

.timeline-zoom-inner {
  max-width: 96vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  border-radius: 12px;
  background: #0b1120;
}

.timeline-zoom-image {
  display: block;
  max-width: none;
}

/* Таймлайн прилипает к верху экрана при скролле (ПК + моб) */
.timeline-bar {
  position: sticky;
  top: 0;
  z-index: 30; /* выше основного контента, ниже оверлея зума */
}

/* Фиксированный режим таймлайна (fallback к JS-реализации) */
.timeline-bar-fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
}

/* Перетаскивание увеличенного таймлайна */
.timeline-zoom-inner {
  cursor: grab;
}

.timeline-zoom-inner.is-dragging {
  cursor: grabbing;
}

/* Подсказка с ладошкой/пальцем поверх таймлайна */
.timeline-scroll {
  position: relative; /* чтобы можно было позиционировать подсказку */
}

/* Общий контейнер подсказки */
.timeline-hand-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
  animation: timelineHintFade 2.3s ease-out forwards;
}

.timeline-hand-hint-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;

  background: rgba(15, 23, 42, 0.82); /* тёмный полупрозрачный фон */
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
}

.timeline-hand-icon {
  font-size: 20px;
  line-height: 1;
  animation: timelineHandMove 1.3s ease-in-out 0.25s 1;
}

.timeline-hand-arrows {
  display: flex;
  gap: 10px;
  font-size: 14px;
  opacity: 0.8;
}

.timeline-hand-arrows .arrow {
  animation: timelineArrowPulse 1.3s ease-in-out 0.25s 1;
}

/* Разные иконки для ПК и мобайл */
.timeline-hand-hint--desktop .timeline-hand-icon::before {
  content: "✋";
}

.timeline-hand-hint--mobile .timeline-hand-icon::before {
  content: "👆";
}

/* Состояние скрытия */
.timeline-hand-hint--hide {
  animation: timelineHintFadeOut 0.25s ease-out forwards;
}

/* Анимации */
@keyframes timelineHintFade {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  15% {
    opacity: 1;
    transform: translateY(0);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@keyframes timelineHandMove {
  0% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(14px);
  }
  60% {
    transform: translateX(-14px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes timelineArrowPulse {
  0% {
    transform: translateX(0);
    opacity: 0.2;
  }
  30% {
    transform: translateX(-4px);
    opacity: 1;
  }
  60% {
    transform: translateX(4px);
    opacity: 1;
  }
  100% {
    transform: translateX(0);
    opacity: 0.4;
  }
}

@keyframes timelineHintFadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .timeline-hand-hint-bubble {
    padding: 5px 8px;
    gap: 2px;
  }

  .timeline-hand-icon {
    font-size: 18px;
  }

  .timeline-hand-arrows {
    font-size: 12px;
    gap: 6px;
  }
}

/* Кнопка-гамбургер для перехода к оглавлению (только мобайл) */
.toc-jump-btn {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 2px solid #111827;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  padding: 0;
  outline: none;
  z-index: 40;
}

.toc-jump-btn-inner {
  width: 16px;
  height: 12px;
  position: relative;
}

.toc-jump-btn-inner span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 999px;
  background: #111827;
}

.toc-jump-btn-inner span:nth-child(1) {
  top: 0;
}

.toc-jump-btn-inner span:nth-child(2) {
  top: 5px;
}

.toc-jump-btn-inner span:nth-child(3) {
  top: 10px;
}

/* Размещение на главной (область приветствия) */
.toc-jump-btn--index {
  top: -0.75rem;
  right: -0.5rem;
}

/* Размещение в статье (в шапке статьи) */
.article-header {
  position: relative;
}

.toc-jump-btn--article {
  top: -0.75rem;
  right: -0.5rem;
}

/* Показываем кнопку только на мобайле */
@media (min-width: 900px) {
  .toc-jump-btn {
    display: none;
  }
}
