/* css/style.css */
/* Основные переменные */
:root {
  --page-width: 200mm;
  --max-width-px: 1000px;
  --body-font: "EB Garamond", Georgia, serif;
  --ui-font: "Inter", Arial, sans-serif;
  --text-color: #222222;
  --muted: #6b6b6b;
  --accent: #AD7E2D;
  --page-bg: #fffefb;
  --screen-bg: #f5f3f1;
}

/* Шрифтовые опции */
.font-eb-garamond {
  font-family: "EB Garamond", Georgia, serif;
}

.font-georgia {
  font-family: Georgia, serif;
}

.font-times {
  font-family: "Times New Roman", Times, serif;
}

.font-palatino {
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

/* Общая обёртка страницы */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--screen-bg);
  font-family: var(--ui-font);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 30px 12px;
}

/* Имитация страницы книги */
.page {
  background: var(--page-bg);
  width: min(var(--page-width), var(--max-width-px));
  margin: 20px auto;
  padding: 22mm 18mm;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  box-sizing: border-box;
}

/* Заголовки и метаданные */
h1.title {
  font-family: var(--body-font);
  text-align: center;
  font-size: 20px;
  margin: 0 0 12px;
  letter-spacing: 0.2px;
}

.metadata {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
  font-family: var(--ui-font);
}

/* Тело стихотворения */
.poem {
  font-family: var(--body-font);
  font-size: 16px;           /* увеличенный размер шрифта */
  line-height: 0.84;          /* межстрочный интервал */
  white-space: pre-line;
  max-width: 550px;
  margin: 0 auto 30px;       /* центрирование по горизонтали */
  text-align: left;          /* строчки по левому краю */
  width: fit-content;        /* ширина по содержимому */
}

.poem p {
  margin: 0 0 1em 0;
}

.poem .stanza {
  margin-bottom: 0.1em;
  text-align: left;          /* выравнивание строф по левому краю */
}

/* Примечания */
.notes {
  margin-top: 18px;
  border-top: 1px dashed #ddd;
  padding-top: 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: justify; /* выравнивание по ширине */
  text-justify: inter-word; /* улучшает качество выравнивания */
}

details summary {
  cursor: pointer;
  outline: none;
  font-family: var(--ui-font);
  font-style: italic;
  margin-bottom: 8px;
}

.notes-content {
  font-family: var(--ui-font);
  line-height: 1.5;
}

.line-notes {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px dashed #e0e0e0;
}

.line-notes h4 {
  color: var(--accent);
  margin-bottom: 10px;
  font-size: 14px;
  font-family: var(--ui-font);
}

.line-reference {
  margin: 10px 0;
  padding: 8px 12px;
  background: #f8f8f8;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--text-color);
}

.line-reference em {
  font-style: italic;
  color: var(--accent);
}

/* Навигация */
.breadcrumbs {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.nav-link {
  font-family: var(--ui-font);
  font-size: 14px;
}

/* Панель настроек */
.settings-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 1000;
  font-family: var(--ui-font);
  font-size: 14px;
}

.settings-toggle {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 10px;
}

.font-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.font-option {
  background: none;
  border: 1px solid #ddd;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
}

.font-option:hover {
  background: #f5f5f5;
}

.font-option.active {
  border-color: var(--accent);
  background: #fffaf0;
}

/* Содержание */
.toc {
  font-family: var(--ui-font);
  margin: 20px 0;
}

.toc-section {
  margin-bottom: 25px;
}

.toc-section h3 {
  color: var(--accent);
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: 8px;
}

.toc-list a {
  color: var(--text-color);
  text-decoration: none;
  display: block;
  padding: 2px 5px;
  border-radius: 3px;
}

.toc-list a:hover {
  background: #f5f5f5;
  text-decoration: none;
}

/* Общие стили ссылок */
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Мобильная адаптация */
@media (max-width: 700px) {
  body {
    padding: 12px;
  }

  .page {
    width: 100%;
    padding: 18px;
    margin: 12px auto;
    box-shadow: none;
    border-radius: 0;
  }

  .title {
    font-size: 18px;
  }

  .settings-panel {
    position: static;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }

  .navigation {
    flex-direction: column;
    gap: 10px;
  }
}