	/* ============================================================
   Шрифты
   ============================================================ */

@font-face {
    font-family: Charis;
    src: url(fonts/charis-sil.ttf);
}
@font-face {
    font-family: Charis-Italic;
    src: url(fonts/charis-sil-italic.ttf);
}
@font-face {
    font-family: Charis-Bold;
    src: url(fonts/charis-sil-bold.ttf);
}


/* ============================================================
   Основа
   ============================================================ */

body {
    font-family: Charis;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

sup,
.comment_number {
    color: #FDA50F;
    font-family: Charis-Bold;
    cursor: pointer;
}


/* ============================================================
   Шапка книги
   ============================================================ */

.headers {
    text-align: center;
    margin: 50px 0;
}

.header {
    text-transform: uppercase;
}

.header_1 {
    font-size: 50px;
    color: #a52a2a;
    text-align: center;
}

.header_1_small {
    font-size: 40px;
    color: #a52a2a;
    text-align: left;
}

.header_2 {
    font-size: 20px;
}

.header_3 {
    font-size: 18px;
    font-family: Charis-Bold;
}

.header_4 {
    margin-top: 10px;
    font-size: 17px;
}

.header_5,
.chapter_title {
    margin-top: 4px;
    font-size: 16px;
    font-family: Charis-Bold;
}

.header_year {
    margin-top: 30px;
    font-size: 16px;
    font-family: Charis-Bold;
}


/* ============================================================
   Аннотация
   ============================================================ */

.header_annotation {
    margin-top: 20px;  /* было 100*/
    font-size: 14px;
    text-align: justify;
}

.annotation_item {
    margin-left: 5px;
    margin: 4px 0;
    font-size: 16px;
    text-align: justify;
    text-indent: 1.5em;
    display: block;
}

.annotation_item_caption {
    margin-left: 5px;
    font-size: 16px;
    font-family: Charis-Bold;
    text-align: left;
    display: block;
}

.annotation_item:has(.annotation_item_caption) {
    text-indent: 1.5em;
}

.annotation_ref {
    margin: 30px 200px;
    font-size: 16px;
    font-family: Charis-Italic;
    text-align: center;
}

.annotation_poetry {
    font-family: Charis-Italic;
    text-align: left;
    margin-left: 60px;
}


/* ============================================================
   Оглавление
   ============================================================ */

.content_item_big {
    text-align: left;
    width: 100%;
    margin-left: 60px;
}

.content_item {
    display: inline-block;
    width: 16%;
}

.content_title a {
    color: #6495ed;
    font-family: Charis-Bold;
    font-size: 18px;
}


/* ============================================================
   Структура: книга → глава → шлока
   ============================================================ */

.book {
    padding-top: 150px;
}

.book_title {
    text-align: center;
    font-size: 25px;
    margin-bottom: 10px;
}

.chapter {
    margin-bottom: 60px;
}

.chapter_title {
    margin-top: 30px;
    margin-bottom: 10px;
    text-align: center;
}

/* Шлока: iast слева, перевод справа, номер в правом верхнем углу */
.citation_block {
    display: grid;
    grid-template-columns: 440px 1fr;
    grid-template-areas:
        ".        range"
        "iast     translation"
        "comments comments";
    column-gap: 16px;
    margin-bottom: 20px;
}

.range {
    grid-area: range;
    font-family: Charis-Bold;
    color: #000;
    text-align: right;
    align-self: end;
}

.iast {
    grid-area: iast;
    align-self: start;
    font-size: 16px;
    text-align: left;
    color: #708090;
    word-wrap: break-word;
    word-break: break-word;
}

.translation {
    grid-area: translation;
    font-size: 18px;
    text-align: justify;
    word-wrap: break-word;
    word-break: break-word;
}

.translation2 {
    grid-column: 1 / -1;
    font-size: 18px;
    text-align: left;
    word-wrap: break-word;
    word-break: break-word;
}

.comments {
    grid-area: comments;
    margin-bottom: 30px;
    font-size: 18px;
    text-align: justify;
    color: #5f5f5f;
}

/* Перевод без санскрита (одна колонка) */

/* ============================================================
   Дополнительные классы блоков
   ============================================================ */

.iast_author,
.translation_author {
    font-family: Charis-Italic;
}

.iast_dhruva,
.translation_dhruva {
    font-family: Charis-Bold;
}

.sanskrit {
    font-family: Sahitya;
    font-size: 25px;
}

.person_translation,
.person_iast {
    color: #FDA50F;
}

.comment_text {
    text-align: justify;
}

.footnote_text {
    margin-left: 40px;
    color: #9e9e9e;
    text-align: justify;
    font-size: 90%;
}

.file_info {
    font-size: 12px;
    text-align: left;
    text-indent: 1.5em;
    display: block;
}

.blue-text {
    color: SteelBlue;
}

.red-text {
    color: red;
}

.indent {
    display: inline-block;
    width: 2em;
}


/* ============================================================
   Концовки глав и книг
   ============================================================ */

.endchapter_sanskrit {
    font-size: 16px;
    text-align: center;
    color: #708090;
}

.endchapter {
    font-size: 18px;
    text-align: center;
    font-family: Charis-Italic;
}

.endbook {
    text-align: center;
    font-size: 18px;
}


/* ============================================================
   Широкий режим (body.wide-mode)
   ============================================================ */

body.wide-mode .iast {
    margin-left: 275px;
    box-sizing: border-box;
}

body.wide-mode .translation {
    margin-left: 10px;
}


/* ============================================================
   Анимации
   ============================================================ */

@keyframes fire {
    30%, 70% { color: red; }
}

.clipboard-processed,
.clipboard-processed *:not(.comments):not(.comments *) {
    animation: fire 1500ms 1;
}


/* ============================================================
   Адаптив (телефон)
   ============================================================ */

@media (max-width: 1180px) {
    body { width: 100% !important; box-sizing: border-box; padding: 0 12px; }
}

@media (max-width: 700px) {
    .citation_block {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "iast        range"
            "translation translation"
            "comments    comments";
    }

    .iast {
        padding-right: 0;
    }

    .annotation_ref {
        margin: 30px 0;
    }

    body.wide-mode .iast {
        margin-left: 0;
    }
}

/* ============================================================
   Панель прогресса
   ============================================================ */

#rv-panel {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: fit-content;
    max-width: calc(100vw - 24px);
    bottom: auto;
    right: auto;
    display: flex;
    align-items: stretch;
    background: rgba(35, 28, 20, 0.93);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0 10px;
    z-index: 9999;
    font-family: Georgia, serif;
    font-size: 11px;
    color: #ccc;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
    border-radius: 0 0 8px 8px;
    box-sizing: border-box;
}

#rv-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 0;
    position: relative;
}

#rv-label {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ddd;
    flex-shrink: 1;
    cursor: pointer;
}

#rv-bar {
    width: 80px;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 999px;
    flex-shrink: 0;
    overflow: hidden;
}

#rv-bar-fill {
    height: 100%;
    width: 0%;
    background: #c8a84b;
    border-radius: 999px;
    transition: width 0.2s ease;
}

#rv-pct {
    color: #c8a84b;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 2.8em;
    text-align: right;
}

#rv-panel .rv-sep {
    width: 1px;
    height: 14px;
    background: rgba(255,255,255,0.15);
    flex-shrink: 0;
}

#rv-panel button {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 2px 5px;
    font-size: 13px;
    line-height: 1;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

#rv-panel button:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Меню позиций */
#rv-pos-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    top: auto;
    right: 0;
    background: rgba(30, 24, 16, 0.97);
    border-radius: 8px;
    padding: 6px 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    white-space: nowrap;
    flex-direction: column;
    gap: 2px;
    z-index: 10000;
    min-width: 180px;
}

#rv-pos-menu.open {
    display: flex;
}

#rv-pos-menu button {
    font-size: 12px;
    text-align: left;
    padding: 5px 12px;
    color: #bbb;
    border-radius: 5px;
    width: 100%;
}

#rv-pos-menu button:hover,
#rv-pos-menu button.active {
    color: #fff;
    background: rgba(200, 168, 75, 0.25);
}

#rv-pos-menu button.active {
    color: #c8a84b;
}

@media (max-width: 600px),
       (orientation: landscape) and (max-height: 500px) and (max-width: 900px) {
    #rv-panel {
        bottom: 60px;
        bottom: calc(100vh - 100dvh + 12px);
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
    #rv-label { max-width: 160px; }
    #rv-bar,
    #rv-bar + .rv-sep { display: none; }
    #rv-btn-pos,
    #rv-btn-pos + div { display: none; }
}

/* ============================================================
   collapsible_block
   ============================================================ */

.collapsible_block {
  margin: 10px 0;
}
.collapsible_summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 6px;
  user-select: none;
  list-style: none;
  font-size: 1em;
}
.collapsible_summary::-webkit-details-marker { display: none; }
.collapsible_summary::before {
  content: '+';
  display: inline-block;
  font-size: 1.3em;
  font-weight: bold;
  line-height: 1;
  transition: transform 0.2s ease;
  width: 1em;
  text-align: center;
}
details[open] > .collapsible_summary::before {
  content: '−';
}

