/* «Империи» — шкала времени: стрелка под линией и раскрывающаяся панель «все империи на одной шкале». Разметка строит js/timeline.js.
   Сама линия (.tl, .tl__seg, .tl__era, .tl__peak…) описана в style.css. */

/* ---------- Стрелка под линией: язычок на нижней кромке шапки, по центру ---------- */
.tl__more {
  position: absolute; left: 50%; top: calc(100% - 1px); z-index: 1; width: 46px; height: 18px; margin-left: -23px; padding: 0;
  display: grid; place-items: center; color: var(--muted);
  background: rgba(var(--paper-rgb), .94); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px;
  transition: color .2s, background .2s;
}
.tl__more::before { content: ''; position: absolute; inset: -8px -12px -14px; } /* площадка для пальца больше самого язычка */
.tl__more:hover, .tl__more[aria-expanded="true"] { color: var(--accent); }
.tl__more:focus-visible { outline-offset: 2px; }
.tl__more svg {
  width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .45s cubic-bezier(.2, .7, .2, 1);
}
.tl__more[aria-expanded="true"] svg { transform: rotate(180deg); }

/* ---------- Панель: идёт в потоке страницы сразу под шапкой и раздвигает страницу ---------- */
.tlx {
  position: relative; z-index: 2; display: grid; grid-template-rows: 0fr; visibility: hidden;
  transition: grid-template-rows .55s cubic-bezier(.2, .7, .2, 1), visibility 0s linear .55s;
}
.tlx.is-open { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .55s cubic-bezier(.2, .7, .2, 1), visibility 0s; }
.tlx__clip { min-height: 0; overflow: hidden; background: rgba(var(--paper-rgb), .90); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3); }
.tlx.is-open .tlx__clip { box-shadow: 0 26px 44px -26px rgba(0, 0, 0, .45); }
/* те же поля и та же ширина, что у .tl: полоса строки и линия под меню совпадают по пикселям */
.tlx__in { max-width: calc(var(--sheet) + 2 * var(--pad)); margin: 0 auto; padding: 30px var(--pad) 18px; border-bottom: 1px solid var(--line); }
.tlx__cap {
  display: flex; justify-content: space-between; gap: 16px;
  font: 500 11px/1.2 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.tlx__axis { position: relative; height: 12px; margin-top: 12px; }
.tlx__axis span { position: absolute; top: 0; transform: translateX(-50%); font: 500 10px/1 var(--mono); letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
.tlx__axis span:first-child { transform: none; }
.tlx__axis span:last-child { transform: translateX(-100%); }
.tlx__axis i { font-style: normal; }
.tlx__axis .ls { display: none; }

.tlx__body { position: relative; margin-top: 10px; }
/* тонкие вертикальные линии тысячелетий и красная линия нашей эры идут через все строки */
.tlx__grid { position: absolute; inset: 0; pointer-events: none; }
.tlx__line { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid rgba(23, 23, 26, .11); }
.tlx__line--era { border-left-color: rgba(224, 32, 27, .5); }
.tlx__line--era::before {
  content: ''; position: absolute; left: -5px; top: -5px; width: 9px; height: 9px; border-radius: 50%;
  background: #e0201b; box-shadow: 0 0 0 2px rgba(var(--paper-rgb), .95);
}

.tlx__list { position: relative; list-style: none; margin: 0; padding: 0; }
.tlx__row {
  position: relative; display: block; width: 100%; height: 32px; padding: 0; border-radius: 8px; text-align: left;
  transition: background .2s, box-shadow .2s;
}
.tlx__row:hover, .tlx__row:focus-visible { background: color-mix(in srgb, var(--c) 8%, transparent); }
.tlx__row:focus-visible { outline-offset: -2px; }
.tlx__row.is-on { background: color-mix(in srgb, var(--c) 10%, transparent); box-shadow: inset 3px 0 0 var(--c); }
.tlx__bar {
  position: absolute; top: 50%; height: 8px; margin-top: -4px; border-radius: 4px; background: var(--c); opacity: .9;
  transition: box-shadow .2s, opacity .2s;
}
.tlx__row:hover .tlx__bar, .tlx__row:focus-visible .tlx__bar, .tlx__row.is-on .tlx__bar { opacity: 1; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 17%, transparent); }
.tlx__peak { /* золотая метка пика: внутри нарисованной полосы */
  position: absolute; top: 50%; width: 3px; height: 14px; margin: -7px 0 0 -1.5px; border-radius: 2px; background: var(--gold);
  box-shadow: 0 0 0 1.5px var(--paper);
}
.tlx__lab {
  position: absolute; top: 50%; transform: translateY(-50%); max-width: 100%; display: flex; align-items: baseline; gap: 8px; white-space: nowrap;
  padding: 2px 6px; border-radius: 6px; background: rgba(var(--paper-rgb), .82); line-height: 1.25;
}
.tlx__name { font: 600 14px/1.25 var(--text); letter-spacing: -.005em; color: var(--c); }
.tlx__rk { font: 500 10px/1 var(--mono); letter-spacing: .05em; color: var(--muted); }
.tlx__yrs { font: 500 10.5px/1 var(--mono); letter-spacing: .03em; color: var(--muted); }

/* название над полосой (телефон и случаи, когда сбоку не помещается) */
.tlx__row.is-stack { height: auto; padding: 5px 0 20px; }
.tlx__row.is-stack .tlx__lab { position: relative; top: auto; transform: none; width: fit-content; flex-wrap: wrap; row-gap: 2px; } /* длинная подпись переносится, высота строки растёт */
.tlx__row.is-stack .tlx__name { white-space: normal; }
.tlx__row.is-stack .tlx__bar { top: auto; bottom: 6px; margin-top: 0; }
.tlx__row.is-stack .tlx__peak { top: auto; bottom: 3px; margin-top: 0; }

/* подсказка строки: тот же вид, что у подсказок линии, но над строкой — стрелка внизу */
.tlx__tip { z-index: 6; white-space: pre-line; text-align: center; }
.tlx__tip::before { top: auto; bottom: -4px; }

@media (max-width: 760px) {
  .tlx__in { padding-top: 32px; }
  .tlx__hint { display: none; }
  .tlx__axis .lf { display: none; }
  .tlx__axis .ls { display: inline; }
  .tlx__name { font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .tlx, .tlx.is-open { transition: none; }
  .tl__more svg { transition: none; }
}
