/* ==========================================================================
   ИМПЕРАТОРСКИЙ СТИЛЬ: ПОДНЕБЕСНАЯ (ХРОНИКА ЦИВИЛИЗАЦИИ)
   Чистые кастомные стили, эффекты стекла, традиционная китайская эстетика.
   ========================================================================== */

/* 1. Стилизация полосы прокрутки браузера */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #12141c;
}
::-webkit-scrollbar-thumb {
  background: #3e445a;
  border-radius: 4px;
  border: 1px solid rgba(201, 168, 106, 0.25);
}
::-webkit-scrollbar-thumb:hover {
  background: #c9a86a;
}

/* 2. Золотой градиент для парадных заголовков */
.text-gradient-gold {
  background: linear-gradient(135deg, #f6ecd0 0%, #c9a86a 50%, #9a8250 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 3. Киноварно-красный градиент для акцентных дат и цифр */
.text-gradient-crimson {
  background: linear-gradient(135deg, #f0907a 0%, #d0614a 50%, #8a3324 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 4. Традиционная квадратная красная императорская печать (Инь / Си) */
.imperial-seal {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #d0614a;
  color: #e8806a;
  box-shadow: inset 0 0 10px rgba(208, 97, 74, 0.6), 0 0 12px rgba(208, 97, 74, 0.4);
  background: rgba(156, 59, 43, 0.15);
  border-radius: 4px;
  font-family: 'Noto Serif SC', serif;
  font-weight: 900;
  letter-spacing: 0.1em;
  user-select: none;
}

/* 5. Декоративные золотые уголки рамок в китайском стиле */
.ornament-corner {
  position: relative;
}
.ornament-corner::before,
.ornament-corner::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: #c9a86a;
  pointer-events: none;
  transition: all 0.3s ease;
}
.ornament-corner::before {
  top: -2px;
  left: -2px;
  border-top: 2px solid #c9a86a;
  border-left: 2px solid #c9a86a;
}
.ornament-corner::after {
  bottom: -2px;
  right: -2px;
  border-bottom: 2px solid #c9a86a;
  border-right: 2px solid #c9a86a;
}
.ornament-corner:hover::before,
.ornament-corner:hover::after {
  width: 22px;
  height: 22px;
  border-color: #ecdeba;
}

/* 6. Мягкая пульсация золотого свечения */
@keyframes goldenPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(201, 168, 106, 0.6);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(201, 168, 106, 0);
  }
}
.animate-gold-pulse {
  animation: goldenPulse 2.5s infinite;
}

/* 7. Эффект матового стекла карточек (Glassmorphism) */
.glass-panel {
  background: rgba(32, 36, 50, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(201, 168, 106, 0.2);
}
.glass-panel:hover {
  border-color: rgba(201, 168, 106, 0.45);
}

/* 8. Анимация звуковых полосок эквалайзера для кнопки плеера */
@keyframes eq1 { 0%, 100% { height: 4px; } 50% { height: 13px; } }
@keyframes eq2 { 0%, 100% { height: 13px; } 50% { height: 6px; } }
@keyframes eq3 { 0%, 100% { height: 7px; } 50% { height: 14px; } }
.eq-bar-1 { animation: eq1 0.75s infinite ease-in-out; }
.eq-bar-2 { animation: eq2 0.55s infinite ease-in-out; }
.eq-bar-3 { animation: eq3 0.85s infinite ease-in-out; }

/* 9. Растворение краев фонового фото hero-секции */
.hero-bottom-fade {
  background: linear-gradient(to bottom, transparent 0%, rgba(18, 20, 28, 0.3) 25%, rgba(18, 20, 28, 0.85) 60%, #12141c 95%, #12141c 100%);
}
.hero-top-fade {
  background: linear-gradient(to bottom, #12141c 0%, rgba(18, 20, 28, 0.7) 50%, transparent 100%);
}

/* 10. Мобильная вертикальная линия времени */
.mobile-timeline-line {
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  left: 1.25rem;
  width: 2px;
  background: linear-gradient(to bottom, #c9a86a, #d0614a, #c9a86a);
  opacity: 0.35;
}

/* 11. Активная кнопка таба династии (ScrollSpy) */
.dynasty-tab-active {
  background: rgba(201, 168, 106, 0.25) !important;
  border-color: #c9a86a !important;
  color: #f6ecd0 !important;
  box-shadow: 0 0 15px rgba(201, 168, 106, 0.35);
}

/* 12. Мобильное выдвижное меню */
#mobile-menu-drawer {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}
#mobile-menu-drawer.menu-closed {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
#mobile-menu-drawer.menu-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   13. ЦВЕТОВЫЕ ПЕРЕМЕННЫЕ (тёмная тема — по умолчанию) И СВЕТЛАЯ ТЕМА
   Класс .light на <html> включает светлую «рисовую бумагу».
   ========================================================================== */
:root {
  --c-black: 18 20 28;
  --c-deep: 26 29 41;
  --c-card: 33 37 52;
  --c-cardHover: 42 47 66;
  --c-border: 62 69 92;
  --c-gold: 201 168 106;
  --c-goldLight: 236 222 186;
  --c-goldMuted: 154 130 84;
}

html.light {
  color-scheme: light;
  --c-black: 247 241 227;
  --c-deep: 239 230 208;
  --c-card: 255 251 241;
  --c-cardHover: 250 242 222;
  --c-border: 217 201 163;
  --c-gold: 143 107 0;
  --c-goldLight: 122 90 0;
  --c-goldMuted: 110 82 12;
  --ink-1: 28 20 16;
  --ink-2: 52 43 34;
  --ink-3: 94 84 69;
  --ink-4: 110 99 84;
}

/* Иконка переключателя: солнце в тёмной теме, луна — в светлой */
html.light .icon-sun { display: none; }
html:not(.light) .icon-moon { display: none; }

/* Текст (стандартные серые и белый Tailwind) */
html.light .text-white { color: rgb(var(--ink-1)); }
html.light .text-gray-200,
html.light .text-gray-300 { color: rgb(var(--ink-2)); }
html.light .text-gray-400 { color: rgb(var(--ink-3)); }
html.light .text-gray-500 { color: rgb(var(--ink-4)); }
html.light a.from-imperial-crimson { color: #fff; }

/* Зелёные акценты (тест, подписи) */
html.light .text-emerald-300 { color: #065f46; }
html.light .text-emerald-400 { color: #047857; }
html.light .bg-emerald-950\/30,
html.light .bg-emerald-950\/40 { background-color: rgba(16, 185, 129, 0.12); }

/* Фон-каркас */
html.light body { background-color: rgb(var(--c-black)); }
html.light ::-webkit-scrollbar-track { background: #efe6d0; }
html.light ::-webkit-scrollbar-thumb { background: #d9c9a3; border-color: rgba(143, 107, 0, 0.3); }
html.light ::-webkit-scrollbar-thumb:hover { background: #8f6b00; }

/* Градиентные заголовки */
html.light .text-gradient-gold {
  background-image: linear-gradient(135deg, #8F6B00 0%, #B8860B 50%, #6E5200 100%);
}
html.light .text-gradient-crimson {
  background-image: linear-gradient(135deg, #D9482B 0%, #B02E18 50%, #8a3324 100%);
}

/* Печать, стекло, тени */
html.light .imperial-seal {
  color: #b02e18;
  border-color: #b02e18;
  background: rgba(208, 97, 74, 0.08);
  box-shadow: inset 0 0 8px rgba(208, 97, 74, 0.2), 0 0 8px rgba(208, 97, 74, 0.2);
}
html.light .glass-panel {
  background: rgba(255, 251, 241, 0.82);
  border-color: rgba(143, 107, 0, 0.25);
}
html.light .glass-panel:hover { border-color: rgba(143, 107, 0, 0.5); }
html.light .shadow-card-glass { box-shadow: 0 10px 30px -12px rgba(90, 60, 10, 0.25); }
html.light .ornament-corner::before,
html.light .ornament-corner::after { border-color: #8f6b00; }

/* Активный таб династии */
html.light .dynasty-tab-active {
  background: #8f6b00 !important;
  border-color: #8f6b00 !important;
  color: #fffaf0 !important;
  box-shadow: 0 0 15px rgba(143, 107, 0, 0.3);
}

/* Hero: фото становится мягкой подложкой, текст — тёмный */
html.light #hero-bg-img { filter: brightness(1.1) saturate(0.8); opacity: 0.4; }
html.light .hero-bottom-fade {
  background: linear-gradient(to bottom, transparent 0%, rgba(247, 241, 227, 0.3) 25%, rgba(247, 241, 227, 0.85) 60%, #f7f1e3 95%, #f7f1e3 100%);
}
html.light .hero-top-fade {
  background: linear-gradient(to bottom, #f7f1e3 0%, rgba(247, 241, 227, 0.7) 50%, transparent 100%);
}

/* Лайтбокс остаётся тёмным — возвращаем ему тёмные значения */
html.light #photo-modal {
  --c-gold: 201 168 106;
  --c-goldLight: 236 222 186;
  --ink-1: 255 255 255;
  --ink-2: 209 213 219;
  --ink-3: 156 163 175;
}


/* ==========================================================================
   14. МЯГКИЙ ТЕКСТ В ТЁМНОЙ ТЕМЕ (вместо чисто белого и холодно-серого)
   ========================================================================== */
html:not(.light) .text-white { color: #f1ead9; }
html:not(.light) .text-gray-200 { color: #dcd6c6; }
html:not(.light) .text-gray-300 { color: #c6c0b2; }
html:not(.light) .text-gray-400 { color: #a29e94; }
html:not(.light) .text-gray-500 { color: #85827b; }
html:not(.light) .text-emerald-400 { color: #7fcfae; }
