/* ==========================================================================
   Таймлайн биографий — /timeline/
   Mobile-first: базовый слой — вертикальные кластеры по десятилетиям (вариант C).
   Desktop (≥1024px): JS показывает горизонтальный grid (вариант B) и прячет кластеры.
   ========================================================================== */

.timeline-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 16px 48px;
  box-sizing: border-box;
}

.timeline-header {
  text-align: center;
  margin: 8px 0 20px;
}
.timeline-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0 0 8px;
  color: #2b3744;
}
.timeline-sub {
  color: #5b6b7a;
  max-width: 640px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.5;
}

/* --- Навигация по десятилетиям (sticky) --- */
.timeline-decadenav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 4px;
  margin: 0 -4px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #e6ebf0;
  scrollbar-width: thin;
}
.timeline-decadenav__chip {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef2f6;
  color: #46566a;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.timeline-decadenav__chip:hover,
.timeline-decadenav__chip:focus {
  background: #4c5c6d;
  color: #fff;
}

/* ==========================================================================
   Базовый слой: кластеры по десятилетиям (вариант C)
   ========================================================================== */
.tl-decade {
  margin-bottom: 36px;
  scroll-margin-top: 64px;
}
.tl-decade__title {
  font-size: 1.4rem;
  color: #2b3744;
  margin: 0 0 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid #ffd166;
  display: inline-block;
}
.tl-decade__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

/* --- Карточка персоны --- */
.tl-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e6ebf0;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tl-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(40, 55, 70, 0.12);
  border-color: #cfd9e2;
}
.tl-card__photo {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: #eef2f6;
}
.tl-card__photo--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #9aa9b8;
  text-transform: uppercase;
}
.tl-card__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}
.tl-card__name {
  font-weight: 700;
  font-size: 1rem;
  color: #2b3744;
  line-height: 1.25;
}
.tl-card__years {
  font-size: 0.85rem;
  color: #6a7989;
}
.tl-card__cat {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  color: #46566a;
  background: #eef2f6;
  padding: 2px 8px;
  border-radius: 999px;
}
/* мини-bar продолжительности жизни на общей оси */
.tl-card__bar {
  position: relative;
  display: block;
  height: 4px;
  margin-top: 4px;
  background: #eef2f6;
  border-radius: 999px;
  overflow: hidden;
}
.tl-card__bar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  min-width: 3px;
  background: #4c5c6d;
  border-radius: 999px;
}
.tl-card__bar-fill--alive {
  background: linear-gradient(90deg, #2a9d8f, #2a9d8f 70%, rgba(42, 157, 143, 0.2));
}

.timeline-empty {
  text-align: center;
  color: #6a7989;
  padding: 40px 0;
}

/* ==========================================================================
   Desktop grid (вариант B) — управляется timeline.js, по умолчанию hidden
   ========================================================================== */
.timeline-grid {
  margin-bottom: 28px;
}
.timeline-grid__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.tl-legend__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #d8e0e8;
  background: #fff;
  color: #46566a;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity .15s, box-shadow .15s;
}
.tl-legend__chip::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--c, #888);
}
.tl-legend__chip.is-active {
  opacity: 1;
  box-shadow: inset 0 0 0 1px var(--c, #888);
}

.timeline-grid__scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #e6ebf0;
  border-radius: 14px;
  background:
    repeating-linear-gradient(90deg, #f7f9fb, #f7f9fb 1px, transparent 1px, transparent 80px);
  padding: 36px 0 8px;
}

.tl-axis {
  position: relative;
  height: 0;
}
.tl-axis__tick {
  position: absolute;
  top: -28px;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 600;
  color: #9aa9b8;
  white-space: nowrap;
}
.tl-axis__tick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  width: 1px;
  height: 9999px;
  background: #eef2f6;
}

.tl-lane {
  position: relative;
  min-width: 900px;
}
.tl-bar {
  position: absolute;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding: 0 8px 0 13px;
  box-sizing: border-box;
  color: #fff;
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  transition: filter .12s, transform .12s;
  /* Направленность линии жизни (п.1): остриё слева — к настоящему. Ось времени
     идёт слева→направо в прошлое, а жизни тянутся обратно, к нам (из прошлого
     в настоящее), поэтому стрелка смотрит влево. */
  clip-path: polygon(7px 0, 100% 0, 100% 100%, 7px 100%, 0 50%);
}
.tl-bar:hover {
  filter: brightness(1.08);
  transform: scaleY(1.12);
  z-index: 5;
  box-shadow: 0 4px 12px rgba(40, 55, 70, 0.25);
}
/* Живые: ось развёрнута (сегодня слева), открытый конец «в наши дни» — на
   ЛЕВОМ крае → fade слева (270deg). Подпись прижата к правому (год рождения)
   краю, где бар непрозрачный. */
/* Ныне живущие сгруппированы в верхней части полотна (логика в timeline.js,
   п.4). Их линии доходят до левого края — «наших дней». Маленький маркер на
   остром (левом) конце подчёркивает, что линия продолжается в настоящее. */
.tl-bar--alive::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  /* currentColor = контрастный цвет текста полоски (см. textOn в JS): белая
     точка на тёмных барах, тёмная — на светлых (золото). */
  background: currentColor;
  opacity: 0.85;
}
.tl-bar__label {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Годы жизни прямо на полоске. flex:0 0 auto → при нехватке места обрезается
   имя (многоточием), а годы остаются видны всегда. Чуть приглушены, моноширинные
   цифры — чтобы не «прыгали». */
.tl-bar__years {
  flex: 0 0 auto;
  margin-left: 7px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

/* Разделитель между «ныне живущими» (сверху) и «ушедшими» (снизу). */
.tl-sep {
  position: absolute;
  left: 0;
  width: 100%;
  border-top: 1px dashed #c7d0d9;
  pointer-events: none;
}

/* Верхняя полоса прокрутки — зеркало нижней (п.3). */
.tl-topscroll {
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 6px;
}
.tl-topscroll__inner {
  height: 1px;
}

/* Подсказка-легенда над лентой (только desktop-grid). */
.timeline-grid__hint {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: #6a7989;
  line-height: 1.5;
}
