@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700&family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

/* ========================
   CSS RESET & BASE
   ======================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0f0d0a;
  --bg-secondary: #1a1714;
  --bg-card: #211e19;
  --bg-card-hover: #2a2620;
  --border-color: #3d362c;
  --border-gold: #8b7a56;
  --text-primary: #e8e0d4;
  --text-secondary: #b8ad9a;
  --text-muted: #7a7062;
  --gold: #c9a84c;
  --gold-light: #e2c87a;
  --gold-dark: #8b7a3a;
  --accent-warm: #b85c38;
  --accent-red: #a0422e;
  --quote-bg: #1e1b16;
  --quote-border: #c9a84c;
  --footnote-color: #9a8e7e;
  --success: #4a9e6e;
  --error: #c4433a;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  font-size: 17px;
}

body {
  font-family: 'Lora', 'EB Garamond', Georgia, serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.85;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(201, 168, 76, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(184, 92, 56, 0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(139, 122, 86, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ========================
   PROGRESS BAR
   ======================== */
.progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--bg-secondary);
  z-index: 1000;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
  width: 0%;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(201, 168, 76, 0.4);
}

/* ========================
   STEP INDICATOR
   ======================== */
.step-indicator {
  position: fixed;
  top: 14px;
  right: 24px;
  font-family: 'Playfair Display', serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  z-index: 999;
  background: rgba(15, 13, 10, 0.85);
  backdrop-filter: blur(8px);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.step-indicator:hover {
  border-color: var(--gold-dark);
  color: var(--gold);
}

.dropdown-arrow {
  font-size: 1rem;
  transition: transform var(--transition);
  display: inline-block;
}

.step-dropdown.show~.dropdown-arrow,
.step-indicator:has(.step-dropdown.show) .dropdown-arrow {
  transform: rotate(180deg);
}

.step-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  min-width: 280px;
  max-height: 420px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  z-index: 1000;
}

.step-dropdown.show {
  display: block;
  animation: dropdownIn 0.25s ease-out;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-family: 'Lora', serif;
  cursor: pointer;
  transition: all var(--transition);
}

.dropdown-item:hover {
  background: var(--bg-card-hover);
  color: var(--gold);
}

.dropdown-item.active {
  background: rgba(201, 168, 76, 0.1);
  color: var(--gold);
  border-left: 3px solid var(--gold);
}

.dropdown-num {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--gold-dark);
  min-width: 24px;
}

.dropdown-item.active .dropdown-num {
  color: var(--gold);
}

.step-dropdown::-webkit-scrollbar {
  width: 6px;
}

.step-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.step-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.step-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dark);
}

/* ========================
   SECTIONS / STEPS
   ======================== */
.step {
  display: none;
  min-height: 100vh;
  padding: 60px 20px 80px;
  position: relative;
  z-index: 1;
  animation: fadeIn 0.6s ease-out;
}

.step.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-inner {
  max-width: 860px;
  margin: 0 auto;
}

/* ========================
   TITLE PAGE (step-0)
   ======================== */
.title-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100vh;
  padding: 40px 20px;
}

.title-page .emblem {
  font-size: 4rem;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 20px rgba(201, 168, 76, 0.3));
}

.title-page .university {
  font-family: 'EB Garamond', serif;
  font-size: 0.95rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.title-page h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1.25;
  margin-bottom: 16px;
  text-shadow: 0 2px 20px rgba(201, 168, 76, 0.2);
}

.title-page .subtitle {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 50px;
  max-width: 600px;
}

.title-page .ornament {
  color: var(--gold);
  font-size: 1.6rem;
  letter-spacing: 10px;
  margin-bottom: 50px;
  opacity: 0.6;
}

.title-page .meta-info {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 2;
}

.title-page .meta-info strong {
  color: var(--text-primary);
}

.title-page .year {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--gold-dark);
  margin-top: 30px;
  letter-spacing: 6px;
}

/* ========================
   AUTHOR PAGE
   ======================== */
.author-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 50px;
  text-align: center;
  max-width: 600px;
  margin: 80px auto;
  box-shadow: var(--shadow-md);
}

.author-card .avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin: 0 auto 24px;
  box-shadow: 0 4px 20px rgba(201, 168, 76, 0.2);
}

.author-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.author-card .role {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.author-card .divider {
  width: 60px;
  height: 2px;
  background: var(--gold-dark);
  margin: 20px auto;
}

.author-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
}

/* ========================
   TABLE OF CONTENTS
   ======================== */
.toc-list {
  list-style: none;
  max-width: 700px;
  margin: 30px auto 0;
}

.toc-list li {
  border-bottom: 1px solid var(--border-color);
}

.toc-list li:last-child {
  border-bottom: none;
}

.toc-list a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition);
  border-radius: 8px;
}

.toc-list a:hover {
  background: var(--bg-card-hover);
  color: var(--gold);
  padding-left: 28px;
}

.toc-list .toc-number {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold-dark);
  min-width: 32px;
}

.toc-list a:hover .toc-number {
  color: var(--gold);
}

.toc-list .toc-title {
  font-size: 1.05rem;
}

.toc-list .toc-arrow {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.toc-list a:hover .toc-arrow {
  transform: translateX(4px);
  color: var(--gold);
}

/* ========================
   HEADINGS
   ======================== */
h1,
h2,
h3,
h4 {
  font-family: 'Playfair Display', serif;
}

.step-inner>h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 12px;
  line-height: 1.3;
  text-shadow: 0 2px 12px rgba(201, 168, 76, 0.15);
}

.step-inner>.section-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.step-inner h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold-light);
  margin: 50px 0 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.step-inner h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 36px 0 16px;
}

.step-inner h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 28px 0 12px;
}

/* ========================
   TEXT CONTENT
   ======================== */
.step-inner p {
  margin-bottom: 22px;
  text-align: justify;
  hyphens: auto;
}

.step-inner p:last-child {
  margin-bottom: 0;
}

/* ========================
   FOOTNOTES & TOOLTIPS
   ======================== */
.footnote {
  font-size: 0.85rem;
  color: var(--footnote-color);
  vertical-align: super;
  line-height: 0;
  cursor: pointer;
  transition: color var(--transition);
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  margin-left: 2px;
}

.footnote:hover {
  color: var(--gold);
}

.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  opacity: 0;
  width: 320px;
  background-color: var(--bg-card);
  color: var(--text-primary);
  text-align: left;
  border-radius: 8px;
  padding: 14px 18px;
  position: absolute;
  z-index: 1000;
  bottom: 140%;
  left: 50%;
  margin-left: -160px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-gold);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  transform: translateY(10px);
  font-size: 0.88rem;
  font-family: 'Lora', serif;
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;
  pointer-events: none;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -8px;
  border-width: 8px;
  border-style: solid;
  border-color: var(--border-gold) transparent transparent transparent;
}

.tooltip .tooltip-text::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -7px;
  border-width: 7px;
  border-style: solid;
  border-color: var(--bg-card) transparent transparent transparent;
  z-index: 1;
}

.footnote-text {
  display: inline-block;
}

/* ========================
   BLOCKQUOTES (цитаты)
   ======================== */
blockquote {
  background: var(--quote-bg);
  border-left: 4px solid var(--quote-border);
  margin: 30px 0;
  padding: 24px 28px;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-secondary);
  position: relative;
}

blockquote::before {
  content: '«';
  position: absolute;
  top: 10px;
  left: 12px;
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  color: var(--gold-dark);
  opacity: 0.3;
  line-height: 1;
}

blockquote p {
  margin-bottom: 8px;
  text-align: left;
}

blockquote p:last-child {
  margin-bottom: 0;
}

blockquote cite,
blockquote .quote-source {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-style: normal;
}

/* ========================
   TREATY ARTICLES
   ======================== */
.treaty-article {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px 28px;
  margin: 24px 0;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.85;
}

.treaty-article strong {
  color: var(--text-primary);
  font-style: normal;
}

/* ========================
   IMAGES / ILLUSTRATIONS
   ======================== */
.illustration {
  margin: 36px 0;
  text-align: center;
}

.illustration img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition), box-shadow var(--transition);
}

.illustration img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.illustration figcaption,
.illustration .caption {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 12px;
  line-height: 1.5;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ========================
   NAVIGATION ARROWS
   ======================== */
.step-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 60px;
  padding-top: 30px;
  border-top: 1px solid var(--border-color);
  gap: 16px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'Lora', serif;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.nav-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold-dark);
  color: var(--gold);
  box-shadow: var(--shadow-sm);
}

.nav-btn.prev .arrow {
  font-size: 1.3rem;
  transition: transform var(--transition);
}

.nav-btn.prev:hover .arrow {
  transform: translateX(-4px);
}

.nav-btn.next .arrow {
  font-size: 1.3rem;
  transition: transform var(--transition);
}

.nav-btn.next:hover .arrow {
  transform: translateX(4px);
}

.nav-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ========================
   TESTS / QUIZZES
   ======================== */
.quiz-section {
  margin: 36px 0;
}

.quiz-section h3 {
  margin-bottom: 20px;
}

.quiz-question {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 24px 28px;
  margin-bottom: 20px;
  transition: border-color var(--transition);
}

.quiz-question.correct {
  border-color: var(--success);
}

.quiz-question.incorrect {
  border-color: var(--error);
}

.quiz-question .q-number {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: var(--gold);
  font-size: 0.9rem;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.quiz-question .q-text {
  font-size: 1.05rem;
  margin-bottom: 16px;
  line-height: 1.7;
}

.quiz-options label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
  line-height: 1.5;
}

.quiz-options label:hover {
  background: var(--bg-card-hover);
}

.quiz-options input[type="radio"] {
  accent-color: var(--gold);
  margin-top: 4px;
  flex-shrink: 0;
}

.quiz-result {
  display: none;
  padding: 10px 16px;
  margin-top: 10px;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 500;
}

.quiz-result.show {
  display: block;
}

.quiz-result.correct-msg {
  background: rgba(74, 158, 110, 0.15);
  color: var(--success);
  border: 1px solid rgba(74, 158, 110, 0.3);
}

.quiz-result.incorrect-msg {
  background: rgba(196, 67, 58, 0.15);
  color: var(--error);
  border: 1px solid rgba(196, 67, 58, 0.3);
}

.open-question {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 24px 28px;
  margin-bottom: 20px;
}

.open-question .q-number {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: var(--gold);
  font-size: 0.9rem;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.open-question .q-text {
  font-size: 1.02rem;
  line-height: 1.7;
}

.creative-task {
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.08), rgba(184, 92, 56, 0.05));
  border: 1px solid var(--gold-dark);
  border-radius: 10px;
  padding: 28px 32px;
  margin-top: 30px;
}

.creative-task h4 {
  color: var(--gold);
  margin-top: 0;
  margin-bottom: 12px;
}

.btn-check {
  display: inline-block;
  margin-top: 24px;
  padding: 14px 36px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 15px rgba(201, 168, 76, 0.3);
}

.btn-check:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201, 168, 76, 0.4);
}

.btn-check:active {
  transform: translateY(0);
}

.score-display {
  display: none;
  margin-top: 20px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  text-align: center;
  font-size: 1.1rem;
}

.score-display.show {
  display: block;
}

.score-display .score-number {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--gold);
  display: block;
  margin-bottom: 6px;
}

/* ========================
   SOURCES / BIBLIOGRAPHY
   ======================== */
.sources-list {
  list-style: none;
  counter-reset: source-counter;
}

.sources-list li {
  counter-increment: source-counter;
  padding: 12px 0 12px 40px;
  position: relative;
  border-bottom: 1px solid rgba(61, 54, 44, 0.4);
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.sources-list li::before {
  content: counter(source-counter) '.';
  position: absolute;
  left: 0;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: var(--gold-dark);
}

.sources-list li:last-child {
  border-bottom: none;
}

/* ========================
   START BUTTON (title page)
   ======================== */
.btn-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 40px;
  padding: 16px 40px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(201, 168, 76, 0.3);
  text-decoration: none;
}

.btn-start:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(201, 168, 76, 0.4);
}

.btn-start:active {
  transform: translateY(-1px);
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  .title-page h1 {
    font-size: 2rem;
  }

  .title-page .subtitle {
    font-size: 1.15rem;
  }

  .step {
    padding: 40px 16px 70px;
  }

  .step-inner>h1 {
    font-size: 1.7rem;
  }

  .step-inner h2 {
    font-size: 1.35rem;
  }

  .author-card {
    padding: 30px 24px;
    margin: 40px auto;
  }

  .step-navigation {
    flex-direction: column;
  }

  .nav-btn {
    width: 100%;
    justify-content: center;
  }

  .step-indicator {
    top: 10px;
    right: 12px;
    font-size: 0.75rem;
    padding: 4px 12px;
  }

  blockquote {
    padding: 20px;
  }

  .quiz-question,
  .open-question {
    padding: 18px 20px;
  }
}

@media (max-width: 480px) {
  .title-page h1 {
    font-size: 1.6rem;
  }

  .title-page .emblem {
    font-size: 3rem;
  }

  .toc-list a {
    padding: 14px 12px;
  }
}

/* ========================
   SCROLL-TO-TOP
   ======================== */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--gold);
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 998;
  box-shadow: var(--shadow-sm);
}

.scroll-top-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold-dark);
  transform: translateY(-2px);
}

/* ========================
   ORNAMENTAL DIVIDERS
   ======================== */
.divider-ornament {
  text-align: center;
  color: var(--gold-dark);
  font-size: 1.2rem;
  letter-spacing: 8px;
  margin: 40px 0;
  opacity: 0.5;
}

/* ========================
   LINKS
   ======================== */
a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--gold-light);
}