/* Единые базовые настройки сайта */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    scroll-behavior: smooth;
}
body {
    font-family: "Georgia", serif;
    font-size: 18px;
    line-height: 1.6;
    color: #000000;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    
    /* Твой фирменный мягкий фон солнца на весь экран для ПК */
    background: linear-gradient(rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.75)), url("bg.jpg");
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    
    /* Железная защита от выделения и копирования текста */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    overflow-x: hidden; /* Безопасный запрет на гуляние страницы влево-вправо */
}
/* Контейнер для текста книги */
.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}
/* ШАПКА НА ПК: Теперь она намертво привязана к самому верху окна браузера */
.main-header {
    position: -webkit-sticky;
    position: sticky !important; /* Принудительное прилипание к экрану */
    top: 0 !important; /* Строго на самом верху */
    z-index: 99999 !important; /* Максимальный приоритет видимости над текстом */
    
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background-color: #f7f6f4;
    border-bottom: 1px solid #dcdad6;
    border-left: 1px solid #dcdad6;
    border-right: 1px solid #dcdad6;
    border-radius: 0 0 6px 6px;
    padding: 15px 25px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}
.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    max-width: 100%;
    padding: 0;
}
.logo-link {
    font-weight: bold;
    font-size: 20px;
    color: #000000;
    text-decoration: none;
    white-space: nowrap;
}
.header-menu {
    display: flex;
    gap: 25px;
    flex-shrink: 0;
}
/* Все ссылки в меню одного мягкого чернильного цвета */
.menu-item {
    color: #555566; 
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.menu-item.active {
    color: #555566;
}
/* Оформление контента */
.main-content {
    padding: 40px 0 60px 0;
    flex: 1 0 auto; /* Позволяет контенту плавно прокручиваться под липкой шапкой */
}
.book-intro-block {
    text-align: center;
}
/* Наработанный тобой идеальный размер заголовков глав */
h1, .main-book-title, .chapter-title, .intro-text-wrapper h1 {
    font-size: 18px !important;
    margin-bottom: 20px !important;
    font-weight: bold !important;
    color: #000000 !important;
    text-transform: none !important; 
    font-variant: normal !important;
}
.book-subtitle {
    font-style: italic;
    color: #333333;
    margin-bottom: 40px;
    font-size: 16px;
}
.intro-text-wrapper {
    text-align: left;
    max-width: 700px;
    margin: 0 auto 40px auto;
}
.intro-text-wrapper p {
    margin-bottom: 20px;
}
/* ГЛОБАЛЬНОЕ ИСПРАВЛЕНИЕ КАРТИНОК: Теперь работает везде (и на ПК, и на смартфонах) */
.image-box {
    text-align: center !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 35px auto !important;
    display: block !important;
    clear: both !important;
}
.image-box img {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important; /* Намертво центрирует маленькие картинки */
    border-radius: 4px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15) !important;
}
/* Кнопки переходов */
.action-buttons-zone {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}
.btn {
    display: inline-block;
    padding: 12px 28px;
    font-family: "Georgia", serif;
    font-size: 16px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}
.btn-primary, .btn-secondary {
    background-color: transparent;
    color: #000000;
    border: 1px solid #000000;
}
/* ПОДВАЛ: Полностью без фона, отсечен тонкой аккуратной чертой */
.main-footer {
    max-width: 800px;
    margin: 60px auto 30px auto;
    border-top: 1px solid #c8c6c2;
    background-color: transparent;
    padding: 25px 0 0 0;
    text-align: center;
    font-size: 14px;
    color: #333333;
    flex-shrink: 0;
}
/* ШАПКА НА ТЕЛЕФОНЕ: Растянута от края до края и железно зафиксирована сверху */
@media (max-width: 920px) {
    .main-header {
        position: -webkit-sticky !important;
        position: sticky !important; /* Намертво держим на mobile устройствах */
        top: 0 !important;
        margin: 0 !important; 
        border-left: none !important; 
        border-right: none !important;
        border-radius: 0 !important; 
        width: 100% !important; 
        max-width: 100% !important;
        padding: 15px 10px !important;
    }
    
    .main-header .container {
        flex-direction: column !important; 
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        gap: 8px !important;
    }
    .logo-link {
        font-size: 17px !important;
        white-space: normal !important; 
        display: block !important;
        width: 100% !important;
    }
    .header-menu {
        width: 100% !important;
        justify-content: center !important;
        gap: 30px !important;
    }
    .menu-item {
        font-size: 12px !important;
    }
}
@media (max-width: 768px) {
    .main-footer {
        margin: 40px 20px 20px 20px;
    }
}
/* МОБИЛЬНЫЕ НАСТРОЙКИ: Мертвая аппаратная фиксация Солнца через ::before */
@media (max-width: 600px) {
    body {
        font-size: 16px;
        background: #f7f4ee !important; /* Фоновая подложка */
    }
    body::before {
        content: "";
        position: fixed; /* Прибиваем намертво к экрану телефона */
        top: -10vh; /* Делаем запас сверху */
        left: 0;
        width: 100vw;
        height: 120vh; /* Делаем жесткий запас по высоте против белых полос */
        z-index: -1;
        background: linear-gradient(rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.75)), url("bg.jpg") no-repeat center center;
        background-size: cover;
    }
    .main-content {
        padding: 20px 0 40px 0;
    }
    .action-buttons-zone {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 12px;
    }
    .btn {
        width: 100%;
        text-align: center;
        padding: 14px 20px;
    }
}
