/* Библиотека «Обучение»: книги Гуру, священные тексты, агиографии (jan-56).
   Плеер переиспользует .at-player* из audioteca.css (глобальный). */

.bk-page { display: flex; flex-direction: column; gap: 14px; }

/* --- Hero-карточка «Книги Гуру» (по образцу .vt-cover видеотеки; фото то же) --- */
.bk-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 320px;
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
.bk-cover-photo {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: url('/assets/learning/guru-lectures.webp?v=20261114-guru-v1');
  background-size: cover;
  background-position: center 22%;
}
.bk-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(13, 17, 23, 0.08) 0%,
    rgba(13, 17, 23, 0.32) 46%,
    rgba(13, 17, 23, 0.78) 74%,
    rgba(13, 17, 23, 0.94) 100%
  );
}
.bk-cover-copy { display: flex; flex-direction: column; gap: 7px; padding: 18px 16px 16px; }
.bk-cover-title { font-size: 21px; line-height: 1.22; font-weight: 650; color: #fff; }
.bk-cover-sub { font-size: 13px; line-height: 1.35; color: rgba(255, 255, 255, 0.82); }
.bk-cover .at-progress { margin-top: 4px; }
.bk-cover .at-progress-text { color: #fff; }
.bk-cover .at-progress-track { background: rgba(255, 255, 255, 0.3); }
.bk-cover .at-progress-fill { background: #fff; }
.bk-cover:active { transform: scale(0.985); }

/* --- Плашки-разделы --- */
.bk-cats { display: flex; flex-direction: column; gap: 10px; }
.bk-cat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: inherit;
}
.bk-cat-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.bk-cat-title { font-size: 15px; font-weight: 600; }
.bk-cat-count { font-size: 12.5px; color: rgba(255, 255, 255, 0.5); }
.bk-cat-chevron { width: 16px; height: 16px; color: rgba(255, 255, 255, 0.4); flex: none; }
.bk-cat-chevron svg { width: 100%; height: 100%; }

/* --- Список книг --- */
/* Шапка-плашка раздела удалена (владелец): книги отображаются сразу. */
.bk-books { display: flex; flex-direction: column; gap: 10px; }
.bk-book {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: inherit;
}
.bk-book.is-read .bk-book-title { color: rgba(255, 255, 255, 0.55); }
.bk-book-cover {
  flex: none;
  width: 46px;
  height: 66px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
}
/* advayta-книги без обложки: контурная иконка книги по центру */
.bk-book-fallback { display: inline-flex; color: rgba(255, 255, 255, 0.4); }
.bk-book-fallback svg { width: 22px; height: 22px; }
.bk-book-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-book-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.bk-book-title { font-size: 14.5px; font-weight: 600; }
.bk-book-meta { font-size: 12px; color: rgba(255, 255, 255, 0.5); }
.bk-book-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.bk-badge {
  font-size: 10.5px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.65);
}
.bk-badge.is-audio { border-color: rgba(157, 192, 255, 0.4); color: #9dc0ff; }
.bk-badge.is-preview { border-color: rgba(213, 165, 87, 0.4); color: #d5a557; }
.bk-badge.is-read { border-color: rgba(87, 198, 144, 0.4); color: #57c690; }
.bk-book-chevron { width: 16px; height: 16px; color: rgba(255, 255, 255, 0.4); flex: none; }
.bk-book-chevron svg { width: 100%; height: 100%; }

/* --- Экран книги --- */
.bk-detail { display: flex; flex-direction: column; gap: 12px; }
.bk-detail-row { display: flex; gap: 14px; align-items: flex-start; }
.bk-detail-cover {
  flex: none;
  width: 108px;
  height: 156px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}
.bk-detail-fallback svg { width: 34px; height: 34px; }
.bk-detail-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-detail-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bk-detail-title { margin: 0; font-size: 17px; font-weight: 600; }
.bk-detail-meta { margin: 0; color: rgba(255, 255, 255, 0.5); font-size: 12.5px; }
.bk-detail-annotation {
  margin: 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-line;
}
/* Индикатор прочтения — компактная капсула (референс владельца 2026-11-18) */
.bk-read-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  padding: 5px 11px 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12.5px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.bk-read-toggle-icon { display: inline-flex; align-items: center; }
.bk-read-toggle-icon svg { width: 13px; height: 13px; display: block; }
/* Галочка в состоянии «Прочитано» — вдвое крупнее (владелец 2026-11-18). */
.bk-read-toggle.is-read .bk-read-toggle-icon svg { width: 24px; height: 24px; }
.bk-read-toggle-icon circle { display: block; }
.bk-read-toggle-icon path { display: none; }
.bk-read-toggle.is-read {
  border-color: rgba(108, 190, 124, 0.55);
  background: rgba(108, 190, 124, 0.12);
  color: #7ed492;
}
.bk-read-toggle.is-read .bk-read-toggle-icon circle { display: none; }
.bk-read-toggle.is-read .bk-read-toggle-icon path { display: block; }
.bk-read-toggle:active { transform: scale(0.97); }

/* Превью платной книги: подпись + золотая кнопка полной версии (референс) */
.bk-preview-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  line-height: 1.4;
}
.bk-preview-note-icon { display: inline-flex; }
.bk-preview-note-icon svg { width: 16px; height: 16px; }
.bk-full-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, #e6b45a 0%, #c9973c 100%);
  color: #241a08;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.bk-full-btn-arrow { font-size: 14px; line-height: 1; }
.bk-full-btn:active { transform: scale(0.985); }
.bk-full-site {
  margin: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
}

.bk-resume {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(157, 192, 255, 0.35);
  border-radius: 14px;
  background: rgba(157, 192, 255, 0.07);
  color: #9dc0ff;
  font-size: 14px;
  text-align: left;
}
.bk-resume-icon { width: 18px; height: 18px; flex: none; }
.bk-resume-icon svg { width: 100%; height: 100%; }

.bk-sub { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, 0.75); }
.bk-audio { display: flex; flex-direction: column; }
.bk-audio-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  text-align: left;
  margin-bottom: 8px;
}
.bk-audio-icon { position: relative; width: 18px; height: 18px; flex: none; display: grid; place-items: center; }
.bk-audio-icon svg { width: 100%; height: 100%; }
.bk-audio-play { grid-area: 1 / 1; }
.bk-audio-pause { grid-area: 1 / 1; display: none; }
.bk-audio-item.is-playing .bk-audio-play { display: none; }
.bk-audio-item.is-playing .bk-audio-pause { display: block; }
.bk-audio-title { flex: 1; min-width: 0; font-size: 13.5px; }

.bk-toc { display: flex; flex-direction: column; }
.bk-toc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  text-align: left;
  margin-bottom: 8px;
}
.bk-toc-row.is-current { border-color: rgba(157, 192, 255, 0.4); }
.bk-toc-title { font-size: 13.5px; }

/* --- Читалка --- */
.bk-reader { display: flex; flex-direction: column; gap: 12px; }
.bk-reader-title { margin: 0; font-size: 16px; font-weight: 600; }
.bk-chapter-body { min-height: 120px; }
.bk-chapter-loading, .bk-chapter-error { color: rgba(255, 255, 255, 0.5); font-size: 13.5px; margin: 0; }
.bk-chapter-error { color: rgba(226, 149, 120, 0.9); }
.bk-chapter-text {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.85);
  overflow-wrap: break-word;
  /* стихи advayta приходят <pre> с жёсткими переносами: длинная строка
     (атрибуция цитаты) выезжала за экран — режем и переносим */
  word-break: normal;
}
.bk-chapter-text * { overflow-wrap: anywhere; }
/* Стихи (<pre>): сохраняем авторские переносы строк, но длинные строки
   переносятся; шрифт — общий, не моноширинный */
.bk-chapter-text pre {
  margin: 16px 0;
  padding: 2px 0;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.85);
}
/* Типографика текста (правка владельца: аккуратность, отступы — текст не меняем) */
.bk-chapter-text p { margin: 0 0 14px; }
.bk-chapter-text h1, .bk-chapter-text h2, .bk-chapter-text h3, .bk-chapter-text h4 {
  margin: 26px 0 12px;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -.01em;
  color: rgba(255, 255, 255, 0.95);
}
.bk-chapter-text h3 { font-size: 15.5px; }
.bk-chapter-text h4 { font-size: 15px; }
.bk-chapter-text h1:first-child, .bk-chapter-text h2:first-child, .bk-chapter-text h3:first-child { margin-top: 2px; }
.bk-chapter-text ul, .bk-chapter-text ol {
  margin: 0 0 14px;
  padding-left: 22px;
}
.bk-chapter-text li { margin: 0 0 6px; }
.bk-chapter-text li > p { margin: 0 0 6px; }
.bk-chapter-text blockquote {
  margin: 16px 0;
  padding: 4px 0 4px 14px;
  border-left: 2px solid rgba(213, 165, 87, 0.5);
  color: rgba(255, 255, 255, 0.72);
  font-style: italic;
}
.bk-chapter-text em { font-style: italic; }
.bk-chapter-text strong { font-weight: 650; color: rgba(255, 255, 255, 0.95); }
.bk-chapter-text sup, .bk-chapter-text sub { font-size: 0.7em; }
/* Изображения: по центру, закруглённые (правка владельца) */
.bk-chapter-text img {
  display: block;
  max-width: min(100%, 480px);
  height: auto;
  margin: 18px auto;
  border-radius: 14px;
}
.bk-chapter-text figure { margin: 18px 0; text-align: center; }
.bk-chapter-text figcaption { margin-top: 8px; font-size: 12.5px; color: rgba(255, 255, 255, 0.55); text-align: center; }
.bk-chapter-text hr { margin: 22px auto; width: 64px; border: 0; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.bk-chapter-text a { color: #9dc0ff; text-decoration: none; border-bottom: 1px solid rgba(157, 192, 255, 0.35); }
.bk-chapter-text a:hover { border-bottom-color: #9dc0ff; }
.bk-reader-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.bk-reader-btn {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.85);
  font-size: 13.5px;
}
.bk-reader-btn.is-next { border-color: rgba(157, 192, 255, 0.4); color: #9dc0ff; }
.bk-reader-btn:disabled { opacity: 0.4; }
.bk-reader-counter { font-size: 12.5px; color: rgba(255, 255, 255, 0.5); font-variant-numeric: tabular-nums; }

/* jan-57: постраничная читалка — прогресс прочитанных страниц */
.bk-pages-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 14px;
}
.bk-pages-count {
  font-size: 12px;
  color: #91a4b8;
  white-space: nowrap;
}
.bk-pages-track {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: #1d2c3c;
  overflow: hidden;
}
.bk-pages-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #e6b45a, #c9973c);
  border-radius: 2px;
  transition: width .3s ease;
}
.bk-pages-read {
  font-size: 11px;
  color: #6f8397;
  white-space: nowrap;
}
.bk-toc-page {
  margin-left: auto;
  padding-left: 12px;
  font-size: 11px;
  color: #6f8397;
  white-space: nowrap;
}
.bk-sub-sub {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: #d5a557;
}

/* jan-58: «Прочитано» — компактная капсула по размеру слов (владелец),
   без растяжения на ширину колонки */
.bk-read-toggle {
  align-self: flex-start;
  padding: 4px 10px 4px 8px;
  font-size: 12px;
  gap: 5px;
}

/* jan-58: «Купить» — печатное издание в магазине традиции */
.bk-buy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  padding: 9px 16px;
  border: 1px solid rgba(230, 180, 90, 0.38);
  border-radius: 12px;
  background: rgba(230, 180, 90, 0.08);
  color: #e6b45a;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.bk-buy-icon { display: inline-flex; }
.bk-buy-icon svg { width: 17px; height: 17px; display: block; }

/* jan-58: эмодзи 📖 в кнопке «Читать/Продолжить» */
.bk-resume-emoji { font-size: 18px; line-height: 1; }

/* jan-59: «Читать» + «Купить» в один ряд равной ширины (референс владельца) */
.bk-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.bk-actions-row .bk-resume,
.bk-actions-row .bk-buy {
  flex: 1 1 0;
  width: auto;
  margin-top: 0;
  justify-content: center;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}
.bk-actions-row .bk-resume span,
.bk-actions-row .bk-buy span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.bk-actions-row .bk-buy {
  padding: 12px 14px;
  box-sizing: border-box;
}

/* jan-59: индикатор главы в оглавлении — пустой кружок → зелёная галочка */
.bk-toc-check { display: inline-flex; align-items: center; flex: none; }
.bk-toc-check svg { width: 15px; height: 15px; display: block; }
.bk-toc-check circle { display: block; stroke: rgba(255, 255, 255, 0.35); }
.bk-toc-check path { display: none; }
.bk-toc-row.is-read .bk-toc-check circle { display: none; }
.bk-toc-row.is-read .bk-toc-check path { display: block; stroke: #57c690; }
.bk-toc-row.is-read .bk-toc-title { color: rgba(255, 255, 255, 0.55); }
