/* ============================================================
   HISTORY.CSS — Страница «История театра»
   Театр на Таганке

   Подключается ПОСЛЕ taganka-today.css.
   Все общие блоки (hero, nav, heading, quote, more) —
   стилизованы через today__ классы из taganka-today.css.
   Линия и квадратик в навигаторе — today__facts-line
   и today__facts-icon из taganka-today.css.

   Здесь только специфика:
     — Бар с табами
     — Sticky навигатор-дропдаун
     — Секции контента
     — Лица эпохи
   ============================================================ */


/* ══════════════════════════════════════════════════
   TAB CONTENT
   ══════════════════════════════════════════════════ */
.history__tab-content[hidden] {
  display: none;
}


/* ══════════════════════════════════════════════════
   БАР С ТАБАМИ
   Мобилка: padding 0 (scrollable-табы сами задают margin).
   Планшет/десктоп: padding из inner-pad-x, как page__bar.
   ══════════════════════════════════════════════════ */
.history__tabs-bar {
  display: flex;
  align-items: baseline;
  background: var(--color-bg-warm);
}

.history__tabs-divider {
  width: 100%;
  height: 1px;
  background: var(--color-black-soft);
  margin-top: 24px;
}


/* ══════════════════════════════════════════════════
   STICKY НАВИГАТОР
   Структура: [квадратик] [лейбл по центру] [шеврон ▼]
   Линия и квадратик = today__facts-line / today__facts-icon.
   При is-stuck: чёрный фон, белый текст/иконки.
   ══════════════════════════════════════════════════ */
.history__navigator {
  position: sticky;
  top: 0;
  z-index: var(--z-ui);
  background: var(--color-bg-warm);
  transition: background-color var(--duration-fast) ease;
}

.history__navigator.is-stuck {
  background: var(--color-black-soft);
}

/* Переопределяем цвета today__facts-* при stuck */
.history__navigator.is-stuck .today__facts-line {
  background: var(--color-white-25);
}

.history__navigator.is-stuck .today__facts-icon {
  background: var(--color-white);
}

.history__navigator-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 12px 18px;
}

/* Лейбл — по центру */
.history__navigator-label {
  flex: 1;
  font-family: var(--font-accent);
  font-size: 20px;
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-heading);
  letter-spacing: -0.02em;
  color: var(--color-black-soft);
  font-feature-settings: 'lnum' 1, 'pnum' 1;
  text-align: center;
  white-space: nowrap;
  transition: color var(--duration-fast) ease;
}

.history__navigator.is-stuck .history__navigator-label {
  color: var(--color-white);
}

/* Кнопка шеврон — справа */
.history__navigator-toggle {
  width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--color-black-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--duration-fast) ease;
  -webkit-tap-highlight-color: transparent;
}

.history__navigator.is-stuck .history__navigator-toggle {
  color: var(--color-white);
}

.history__navigator-toggle:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 4px;
}

.history__navigator-toggle svg {
  width: 24px;
  height: 24px;
  transition: transform var(--duration-fast) ease;
}

.history__navigator.is-dropdown-open .history__navigator-toggle svg {
  transform: rotate(180deg);
}


/* ══════════════════════════════════════════════════
   ДРОПДАУН-МЕНЮ НАВИГАТОРА
   ══════════════════════════════════════════════════ */
.history__navigator-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  background: var(--color-black-soft);
  z-index: var(--z-overlay);
  display: none;
  flex-direction: column;
}

.history__navigator-dropdown.is-open {
  display: flex;
}

.history__navigator-dropdown-item {
  display: block;
  width: 100%;
  padding: 14px 12px;
  margin: 0;
  background: none;
  border: none;
  outline: none;
  text-align: center;
  font-family: var(--font-accent);
  font-size: 20px;
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-heading);
  color: var(--color-white);
  font-feature-settings: 'lnum' 1, 'pnum' 1;
  cursor: pointer;
  transition: opacity var(--duration-fast) ease;
  opacity: 0.5;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.history__navigator-dropdown-item:hover,
.history__navigator-dropdown-item:focus-visible {
  opacity: 0.8;
}

.history__navigator-dropdown-item.is-active {
  opacity: 1;
}

.history__navigator-dropdown-item + .history__navigator-dropdown-item {
  border-top: 1px solid var(--color-white-10);
}


/* ══════════════════════════════════════════════════
   СЕКЦИЯ
   ══════════════════════════════════════════════════ */
.history__section {
  padding-bottom: 80px;
}

/* Хедер секции — только десктоп */
.history__section-header {
  display: none;
  margin-bottom: -12px;
}

/* Разделитель между секциями — линия 1px */
.history__section-divider {
  width: 100%;
  height: 1px;
  background: var(--color-black-soft);
}

.history__section-body {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 60px 10px 0;
}

/* Мобилка: right (заголовок+лид+текст+лица) первым, фото вторым */
.history__section-right { order: -1; }

.history__section-right {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.history__section-name {
  font-family: var(--font-accent);
  font-size: 32px;
  font-weight: var(--font-weight-bold);
  line-height: 0.9;
  letter-spacing: -0.035em;
  color: var(--color-black-soft);
}

.history__section-subtitle {
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: var(--font-weight-medium);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--color-black-soft);
}

.history__section-image {
  width: 100%;
  height: 348px;
  overflow: hidden;
  border-radius: var(--card-radius);
}

.history__section-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history__section-text {
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: var(--font-weight-book);
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--color-black-soft);
}

.history__section-text p + p {
  margin-top: 24px;
}


/* ══════════════════════════════════════════════════
   ЛИЦА ЭПОХИ
   ══════════════════════════════════════════════════ */
.history__faces {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.history__faces-title {
  font-family: var(--font-accent);
  font-size: 22px;
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-heading);
  letter-spacing: -0.02em;
  color: var(--color-black-soft);
  font-feature-settings: 'lnum' 1, 'pnum' 1;
}

.history__faces-track {
  display: flex;
  gap: 40px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.history__faces-track::-webkit-scrollbar { display: none; }

.history__face {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  width: 128px;
  text-decoration: none;
  color: var(--color-black-soft);
}

.history__face-photo {
  width: 128px;
  height: 128px;
  border-radius: 1px;
  overflow: hidden;
}

.history__face-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history__face-name {
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: var(--font-weight-book);
  line-height: var(--line-height-heading);
  letter-spacing: -0.01em;
}


/* ══════════════════════════════════════════════════
   АРХИВ — ГРУППЫ ССЫЛОК
   Мини-разделы: заголовок (Фото, СМИ, Документ...)
   над стопкой ссылок без разделителей.
   ══════════════════════════════════════════════════ */
.history__archive-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Разделитель между мини-блоками */
.history__archive-group + .history__archive-group {
  border-top: 1px solid var(--color-black-soft-25);
  padding-top: 32px;
}

/* Тип документа — стили как у лида */
.history__archive-group-title {
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-heading);
  letter-spacing: -0.025em;
  color: var(--color-black-soft);
  opacity: 0.65;
  margin-bottom: 4px;
}

.history__archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.history__archive-link {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0;
  text-decoration: none;
  color: var(--color-black-soft);
  transition: opacity var(--duration-fast) ease;
}

.history__archive-link:hover {
  opacity: 0.6;
}

.history__archive-link-text {
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: var(--font-weight-book);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--color-black-soft);
  flex: 1;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-skip-ink: none;
  text-decoration-thickness: 8%;
  text-underline-offset: 10%;
}

.history__archive-external {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-black-soft-40);
  align-self: center;
}


/* ══════════════════════════════════════════════════
   ПЛАНШЕТ
   ══════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .history__tabs-bar { padding: 0 16px; }
  .history__tabs-divider {
    width: calc(100% - 32px);
    margin-left: 16px;
  }
  .history__section-body { padding-left: 16px; padding-right: 16px; }
  .history__section-image { height: 400px; }
}


/* ══════════════════════════════════════════════════
   ДЕСКТОП (≥1024px)
   ══════════════════════════════════════════════════ */
@media (min-width: 1024px) {

  /* Бар с табами */
  .history__tabs-bar {
    padding: 0 var(--inner-pad-x);
  }

  .history__tabs-divider {
    display: none;
  }

  /* Навигатор скрыт на десктопе */
  .history__navigator {
    display: none;
  }

  /* Разделители скрыты — section-header содержит линию */
  .history__section-divider {
    display: none;
  }

  /* Хедер секции виден на десктопе */
  .history__section-header {
    display: block;
  }

  /* Отступ от табов до первого контента */
  .history__tab-content {
    margin-top: 24px;
  }

  .history__section { padding-bottom: 120px; }

  .history__section-body {
    padding: 40px var(--inner-pad-x) 0;
  }

  /* section-right = grid 1fr 1fr (image внутри right) */
  .history__section-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--inner-col-gap);
    row-gap: 20px;
    align-items: start;
    padding-top: 0;
  }

  /* Фото — левая колонка */
  .history__section-image {
    grid-column: 1;
    grid-row: 1 / span 10;
    height: auto;
    aspect-ratio: 4 / 3;
    margin-top: 0;
    min-width: 0;
  }

  /* Всё остальное — правая колонка */
  .history__section-name,
  .history__section-subtitle,
  .history__section-text,
  .history__faces,
  .history__archive-groups {
    grid-column: 2;
    min-width: 0;
  }

  .history__faces {
  margin-top: 28px;
}

  /* Заголовок: Pragmatica Extended Black */
  .history__section-name {
    font-family: var(--font-accent);
    font-size: 36px;
    font-weight: var(--font-weight-black);
    line-height: 0.9;
    letter-spacing: -0.04em;
  }

  .history__section-subtitle { margin-top: 0; font-size:20px; line-height: 1.25;}
  .history__section-text { font-size: 20px; margin-top: 104px; }

  /* Чётные секции (Эпохи, Хронология): фото справа */
  #tab-epochs section:nth-of-type(even) .history__section-image,
  #tab-chronology section:nth-of-type(even) .history__section-image {
    grid-column: 2;
  }

  #tab-epochs section:nth-of-type(even) .history__section-name,
  #tab-epochs section:nth-of-type(even) .history__section-subtitle,
  #tab-epochs section:nth-of-type(even) .history__section-text,
  #tab-epochs section:nth-of-type(even) .history__faces,
  #tab-chronology section:nth-of-type(even) .history__section-name,
  #tab-chronology section:nth-of-type(even) .history__section-subtitle,
  #tab-chronology section:nth-of-type(even) .history__section-text,
  #tab-chronology section:nth-of-type(even) .history__faces {
    grid-column: 1;
  }

  .history__face-photo { width: 160px; height: 160px; }
  .history__face       { width: 160px; }

  /* Лица адаптивные */
  .history__faces-track {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 24px;
  }
  .history__face {
    flex-shrink: 1;
    width: clamp(100px, 20%, 160px);
  }
  .history__face-photo {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  /* Архив: всё в правой колонке, без grid */
  #tab-archive .history__section-body {
    display: block;
    padding: 0 var(--inner-pad-x);
    margin-top: 20px;
  }

  #tab-archive .history__section-right {
    display: flex;
    flex-direction: column;
    gap: 25px;
    max-width: calc((100% - var(--inner-col-gap)) / 2);
    margin-left: auto;
    padding-top: 0;
  }
}

@media (min-width: 1280px) {
  .history__section-name { font-size: 38px; }
  .history__section-text { font-size: 21px; }
}

@media (min-width: 1440px) {
  .history__section-name { font-size: 40px; }
  .history__section-text { font-size: 22px; }
}