/* ============================================ */
/*           СБРОС БРАУЗЕРНЫХ СТИЛЕЙ            */
/* ============================================ */
:root {
    --paragraph-margin: 1.5em;
    --block-gap: 2em;
    
    /* ОБНОВЛЕНО: Увеличенный базовый шрифт для всего сайта */
    --base-font-size: clamp(18px, 1.75vw + 14px, 20px); 
    
    /* Обновленная палитра */
    --primary-dark: #0f172a;        
    --accent-blue: #1e40af;
    --border-light: #e5e7eb;
    --gold-accent: #ffd700;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}
body, h1, h2, h3, ol {
    margin: 0;
    padding: 0;
}
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Базовый стиль параграфов — ЕДИНСТВЕННОЕ правило для текста */
p {
    font-size: var(--base-font-size);
    line-height: 1.7;
    margin-top: 0;
    margin-bottom: var(--paragraph-margin);
}

/* СПЕЦИАЛЬНО ДЛЯ ГЛАВНОЙ СТРАНИЦЫ: Увеличиваем только текст внутри <p> */
.large-text-home p {
    /* Умножаем базовый размер шрифта на 1.15 (на 15% больше) */
    font-size: calc(var(--base-font-size) * 1.15) !important;
    
    /* Корректируем межстрочный интервал под новый размер */
    line-height: 1.6; 
}

/* ============================================ */
/*             ОБЩИЕ НАСТРОЙКИ ТЕЛА             */
/* ============================================ */
body {
    font-family: 'PT Root UI', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f9f9fb;
}
.content-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 60px;
    background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
}
.site-header {
    background-color: var(--primary-dark);
    color: white;
    text-align: center;
    padding: 60px 20px 50px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}
.subtitle::after {
    content: "";
    display: block;
    width: 60px;
    height: 2px;
    background-color: var(--gold-accent);
    margin: 12px auto 0;
    border-radius: 1px;
}
.site-header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.5em);
    letter-spacing: 1px;
    font-feature-settings: "case" on;
}
.subtitle {
    font-size: clamp(1em, 2.5vw, 1.2em);
    opacity: 0.9;
    margin-top: 10px;
}
.author-name {
    font-size: clamp(1.2em, 3vw, 1.4em);
    margin-top: 20px;
    font-weight: 500;
}
.intro-text p {
    line-height: 1.7;
    margin-bottom: 1.2em;
}

/* Блок автора теперь управляется классом .author-card вместо инлайн-стилей */
.author-card {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column; 
    text-align: center;
    padding: 40px 20px;
    gap: 16px; 
}

.author-info img {
    border-radius: 0;
    box-shadow: 0px 4px 8px rgba(0,0,0,0.1);
    aspect-ratio: 1 / 1.1;
    object-fit: cover;
    margin: 0 auto;
    display: block;
}

/* ============================================ */
/*                 ОГЛАВЛЕНИЕ (TOC)             */
/* ============================================ */
.toc-wide-nav {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 35px 80px;
    font-size: clamp(1em, 2.5vw, 1.1em);
    line-height: 1.4;
    
    max-width: 1200px; 
    margin-left: auto;
    margin-right: auto;
}
.toc-wide-nav h2 {
    margin-top: 0;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 10px;
    font-size: 1.6em;
    text-align: center;
    letter-spacing: 0.5px;
}
.toc-wide-nav ol {
    list-style-type: none;
    padding-left: 0;
    counter-reset: chapter-counter;
}
.toc-wide-nav li {
    margin-bottom: 16px;
    position: relative;
    display: block;
}
.toc-wide-nav li + li {
    border-top: 1px dashed var(--border-light);
    padding-top: 16px;
}

/* СТИЛИ ДЛЯ ССЫЛОК ЧЕРЕЗ FLEXBOX */
.toc-wide-nav a {
    text-decoration: none;
    color: #212121;
    transition: color 0.2s ease;
    display: flex;
    align-items: baseline;
    gap: 8px; 
    width: 100%;
    min-height: 44px;
    padding-right: 15px;
    box-sizing: border-box;
}
.toc-wide-nav a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}
.toc-wide-nav li:hover {
    background-color: #f8fafc;
}

/* КОЛОНКА С НОМЕРАМИ ГЛАВ */
.toc-wide-nav .number {
    flex-shrink: 0;
    width: 95px; 
    font-weight: 600;
    color: #3f51b5;
    font-size: 0.95em;
    letter-spacing: 0.3px;
    text-align: right;
}

/* ТЕКСТ НАЗВАНИЯ ГЛАВЫ */
.toc-wide-nav .chapter-title {
    flex-grow: 1;
    word-break: normal;
}

/* МЕДИА-ЗАПРОСЫ (МОБИЛЬНЫЕ УСТРОЙСТВА) — ИСПРАВЛЕННАЯ ВЕРСИЯ */
@media (max-width: 768px) {
    .content-wrapper {
        padding: 15px;
    }
    .site-header {
        padding: 30px 15px;
    }
    
    /* === БЛОК ОГЛАВЛЕНИЯ (ТОЛЬКО ЗДЕСЬ) === */
    .toc-wide-nav {
        padding: 20px 25px;
        max-width: calc(100% - 30px);
    }
    
    /* Главная ошибка была здесь: было 95px, стало 0 */
    .toc-wide-nav li {
        padding-left: 0; 
        min-height: 48px;
    }
    
    /* Скрываем номера "Глава X", так как они ломают верстку при переносе строк */
    .toc-wide-nav li::before {
        display: none;
    }
    
    .toc-wide-nav a {
        padding-right: 10px;
    }
    
    /* Остальные элементы страницы остаются без изменений */
    .chapter-content {
        padding: 20px;
        margin-left: 10px;
    }
    .chapter-content h1 {
        font-size: 1.5em;
        line-height: 1.3;
        margin-bottom: 1.5em;
    }
    figure.table {
        padding-bottom: 15px;
    }
    .author-info img {
        width: 140px;
    }
    .author-name {
        font-size: 1.2em;
    }
    footer.site-footer a {
        margin-left: 10px;
    }
    .return-link {
        margin-left: 10px;
    }
    .author-info .intro-text p {
        line-height: 1.6;
    }
}

/* ============================================ */
/*   СТИЛИ ДЛЯ ГЛАВ КНИГИ И ОСНОВНОГО КОНТЕНТА  */
/* ============================================ */
.chapter-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 40px;
    margin-bottom: 30px;
}
.chapter-content h1 {
    color: var(--primary-dark);
    margin-top: 0;
    text-align: center;
    font-size: clamp(1.5em, 4vw, 2em);
    margin-bottom: var(--block-gap);
    font-feature-settings: "case" on;
}
.return-link {
    display: inline-block;
    margin-left: 20px; 
    margin-bottom: 20px;
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    font-size: calc(var(--base-font-size) * 1.15);
}
.return-link:hover {
    text-decoration: underline;
}

/* СПЕЦИАЛЬНОЕ ПРАВИЛО ТОЛЬКО ДЛЯ ГЛАВНОЙ СТРАНИЦЫ */
.author-info .intro-text p {
    line-height: 1.6;
}

/* АДАПТИВНОСТЬ ТАБЛИЦ */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin: 30px 0;
    padding-bottom: 10px;
}
table {
    width: 100%;
    border-collapse: collapse;
    word-wrap: anywhere;
}
th, td {
    border: 1px solid #ccc;
    padding: 8px 12px;
    vertical-align: middle;
    text-align: left;
    line-height: 1.7;
}
.is-number,
th.is-number + td {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
th.is-number {
    text-align: right;
}

/* Выравнивание списков ВНУТРИ таблиц */
table ul li,
table ol li {
    text-indent: 0;
    padding-left: 24px; 
    position: relative;
    margin-bottom: 0.5em;
    line-height: 1.7;
}
table ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    top: 0;
    color: #666;
    font-size: 1.1em;
}
table ol {
    list-style-position: inside;
    padding-left: 0;
    counter-reset: item-counter;
}
table ol li {
    display: block;
    padding-left: 0;
    position: relative;
    text-indent: 0;
    margin-bottom: 0.5em;
}
table ol li::before {
    content: counter(item-counter)". ";
    counter-increment: item-counter;
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 600;
    color: #333;
}

/* МЕДИА-ЗАПРОСЫ (МОБИЛЬНЫЕ УСТРОЙСТВА) — ПОВТОРНЫЙ БЛОК УДАЛЕН */
/* Все остальные мобильные стили перенесены выше к .toc-wide-nav */

.total-row {
    font-weight: bold;
    background-color: #f3f4f6;
}

/* СПЕЦИАЛЬНО ДЛЯ ГЛАВНОЙ: КРУПНЫЙ ТЕКСТ */
.large-text-home {
    font-size: clamp(1.1em, 2vw + 0.5vw, 1.2em);
}

/* Исправленный единый блок стилей для телефона */
.contact-button-tel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    
    color: #ffffff; 
    font-size: clamp(1em, 2.5vw, 1.2em);
    text-decoration: none;
    
    background: transparent; 
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    
    transition: all 0.2s ease;
}
.contact-button-tel:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateY(-2px);
}

.site-footer {
    text-align: center;
    padding: 40px 0;
    margin-top: 60px;
    color: #666;
    border-top: 1px solid var(--border-light);
    font-size: 0.9em;
}
.contact-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-dark), var(--accent-blue));
    color: white;
    text-decoration: none;
    border-radius: 999px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 16px;
    font-size: 0.95em;
}
.contact-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 64, 175, 0.3);
}