:root {
    /* 🍁 Московская осень — приглушённые, землистые, тёплые оттенки */
    --autumn-crimson: #993333;     /* Тёмно-бордовый, как мокрые листья */
    --moss-green:     #6B7B52;     /* Зелёный с серым оттенком */
    --amber:          #CC9966;     /* Золотисто-коричневый — солнце сквозь туман */
    --fog-gray:       #B8B8B0;     /* Цвет неба над Москвой */
    --asphalt-gray:   #5F5F5F;     /* Мокрая брусчатка */
    --warm-beige:     #E0D8C8;     /* Тёплый свет в кафе */
    --deep-charcoal:  #333333;     /* Глубокий тёмный фон */
    --lantern-glow:   #D19A66;     /* Огонь в фонаре — акцент */

    /* Унифицированные переменные для интерфейса */
    --primary:        var(--autumn-crimson);
    --secondary:      var(--amber);
    --navbar-start:   var(--primary);
    --navbar-end:     var(--secondary);
    --navbar-shadow:  rgba(0, 0, 0, 0.15);
    --text-color:     #2E2E2E;
    --card-bg:        #ffffff80;
    --overlay:        rgba(51, 51, 51, 0.8);
}

/* === Тёмная тема === */
body.dark-theme {
    --card-bg: #2d2d2d80;
    --text-color: #e0e0e0;
    --fog-gray: #444;
    --asphalt-gray: #333;
    --warm-beige: #c5b8a8;
    --overlay: rgba(0, 0, 0, 0.8);
    --navbar-start:   #5e1d1d;
    --navbar-end:     #2a3b2a;
    --navbar-shadow:  rgba(0, 0, 0, 0.3);

    background: #1a1a1a;
    color: #e0e0e0;
}

body {
    font-family: 'Georgia', serif;
    color: var(--text-color);
    background: linear-gradient(135deg, var(--warm-beige), var(--warm-beige));
    background-size: 400px 400px;
    line-height: 1.8;
    margin: 0;
    min-height: 100vh;
    transition: all 0.3s ease;
}

section {
    scroll-margin-top: 80px;
}

.img-fluid {
    border: 2px solid var(--deep-charcoal);
}

.navbar {
    border: 1px solid var(--deep-charcoal);
    border-radius: 1rem;
    background: linear-gradient(to right, var(--navbar-start), var(--navbar-end));
    box-shadow: 0 2px 15px var(--navbar-shadow);
    transition: all 0.4s ease;
}

.navbar-brand {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--warm-beige) !important;
    animation: fadeIn 2s ease-in-out;
}

.nav-link {
    position: relative;
    color: var(--warm-beige) !important;
    margin: 0 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--secondary);
    transition: width 0.3s ease;
}

.nav-link:hover::after{
    width: 100%;
}

.nav-link.active::after {
    width: 100%;
}
/* .nav-link.active {
    outline: 2px solid var(--secondary);
    outline-offset: 4px 1rem;
    border-radius: 0.5rem;
} */

.poem-container {
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0.5rem 0.5rem 0.5rem rgba(20, 20, 20, 0.3);
    padding: 1rem;
    margin-bottom: 3rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 5px solid var(--secondary);
}

.poem-title {
    color: var(--primary);
    font-family: 'Playfair Display', serif;
    position: relative;
    display: inline-block;
    font-size: 1.4rem;
}

.poem-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, var(--secondary), var(--fog-gray));
}

.poem-content {
    white-space: pre-line;
    font-size: 0.8rem;
    line-height: 1.5rem;
    color: var(--text-color);
}

.footer {
    background: linear-gradient(to right, var(--primary), var(--moss-green));
    color: var(--warm-beige);
    padding: 25px 0;
    text-align: center;
    font-size: 0.95rem;
    border-top: 1px solid var(--fog-gray);
}

/* Переключатель выравнивания — обновлён под стиль */
.alignment-switcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background-color: var(--card-bg);
    border-radius: 50px;
    padding: 10px 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    border: 1px solid var(--fog-gray);
}

.alignment-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0 4px;
    transition: all 0.3s ease;
    background-color: var(--fog-gray);
    color: var(--deep-charcoal);
}

.alignment-btn.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 2px var(--secondary);
}

.alignment-btn:hover {
    background-color: var(--secondary);
    color: white;
    transform: scale(1.1);
}

/* Классы для выравнивания */
.centered {
    text-align: center;
}
.left-aligned {
    text-align: left;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes float {
    0% { transform: scale(0.9) translate(-2px); }
    50% { transform: scale(1.0) translate(2px); }
    100% { transform: scale(0.9) translate(-2px); }
}

@keyframes floatud {
    0% { transform: translateY(0); }
    25% { transform: translateY(-10px); }
    50% { transform: translateY(0px); }
    75% { transform: translateY(10px); }
    100% { transform: translateY(0px); }
}

.floating {
    animation: float 5s ease-in-out infinite;
}

.floatingud {
    animation: floatud 5s ease-in-out infinite;
}

.falling-leaves {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    overflow: hidden; /* на всякий случай */
}

.leaf {
    --size: calc(16px + var(--i) * 3px);
    --speed: calc(12s + var(--i) * 4s);
    --delay: calc(var(--i) * 2.5s);
    --rotate: calc(var(--i) * 37deg); /* не кратно 90 — меньше шаблонов */
}

.leaf:nth-child(10n+1) { left: 5%; }
.leaf:nth-child(10n+2) { left: 22%; }
.leaf:nth-child(10n+3) { left: 40%; }
.leaf:nth-child(10n+4) { left: 65%; }
.leaf:nth-child(10n+5) { left: 85%; }
.leaf:nth-child(10n+6) { left: 12%; }
.leaf:nth-child(10n+7) { left: 33%; }
.leaf:nth-child(10n+8) { left: 55%; }
.leaf:nth-child(10n+9) { left: 75%; }
.leaf:nth-child(10n+10){ left: 92%; }

.leaf {
    position: absolute;
    top: -10%;
    width: var(--size);
    height: var(--size);
    opacity: 0.6;
    animation: fall var(--speed) linear infinite;
    animation-delay: var(--delay);
    transform-origin: top center;
    pointer-events: none;
}

/* Разные формы листьев через background */
.leaf:nth-child(odd) {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 130'%3E%3Cpath fill='currentColor' d='M50,5 C65,5 80,20 75,35 C80,50 65,65 50,70 C35,65 20,50 25,35 C20,20 35,5 50,5 Z M50,20 C55,20 60,25 58,30 C60,35 55,40 50,42 C45,40 40,35 42,30 C40,25 45,20 50,20 Z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.leaf:nth-child(even) {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120'%3E%3Cpath fill='currentColor' d='M50,0 C60,10 70,25 65,40 C75,55 60,70 50,75 C40,70 25,55 35,40 C30,25 40,10 50,0 Z M50,20 C55,22 60,28 58,35 C60,40 55,45 50,47 C45,45 40,40 42,35 C40,28 45,22 50,20 Z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

@keyframes fall {
    0% {
        transform: translateY(-10vh) rotate(0deg) translateX(0);
    }
    50% {
        transform: translateY(50vh) 
                rotate(var(--rotate)) 
                translateX(10px); /* Имитация ветра */
    }
    100% {
        transform: translateY(110vh) 
                rotate(calc(var(--rotate) + 720deg)) 
                translateX(-10px); /* Зигзагообразное падение */
    }
}




body.dark-theme .poem-title {
    color: var(--secondary);
}

body.dark-theme .nav-link,
body.dark-theme .navbar-brand {
    color: var(--warm-beige) !important;
}

body.dark-theme .footer {
    background: linear-gradient(to right, #5e1d1d, #2a3b2a);
}

body.dark-theme .alignment-btn {
    background-color: #444;
    color: var(--warm-beige);
}

body.dark-theme .alignment-btn.active {
    background-color: var(--secondary);
}

/* Тема: фон листвы — прозрачнее в тёмной теме */
body.dark-theme .falling-leaves .leaf {
    opacity: 0.5;
}
#theme-toggle .theme-icon {
    transition: all 0.3s ease;
    display: block;
}

body.dark-theme #theme-toggle .theme-icon {
    color: #FFD700; /* Золото для солнца */
}

body:not(.dark-theme) #theme-toggle .theme-icon {
    color: #E6C29F; /* Тёплое серебро для луны */
}

/* Москвa в фоне — полупрозрачная */
.moscow-silhouette {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('34923.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0.25;
    z-index: -1;
    pointer-events: none;
}

/* Адаптивность */
@media (max-width: 768px) {
    .alignment-switcher {
        bottom: 15px;
        right: 15px;
        padding: 8px;
    }
    .alignment-btn {
        width: 36px;
        height: 36px;
    }
    .navbar-brand {
        font-size: 1.3rem;
    }
}