/* === ОСНОВНАЯ ТИПОГРАФИКА === */
/* Абзацы */
.text p {
    margin: 0 0 1.2em 0;
    font-size: 1.06rem;
    line-height: 1.6;
    text-align: justify;
    hyphens: auto;
}

/* === ЗАГОЛОВКИ === */
.text h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 1.8em 0 0.8em 0;
    padding-bottom: 0.5em;
    line-height: 1.2;
}

.text h2 {
    font-size: 1.9rem;
    font-weight: 700;
    margin: 1.6em 0 0.7em 0;
    line-height: 1.25;
}

.text h3 {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 1.4em 0 0.6em 0;
    line-height: 1.3;
}

.text h4 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 1.2em 0 0.5em 0;
    line-height: 1.35;
}

/* === СПИСКИ === */
.text ul, .text ol {
    margin: 1.2em 0;
    padding-left: 2.2em;
}

.text ul {
    list-style-type: none;
}

.text ul > li {
    position: relative;
    margin-bottom: 0.5em;
    padding-left: 0.5em;
}

.text ul > li::before {
    content: "•";
    font-weight: bold;
    position: absolute;
    left: -1.2em;
    font-size: 1.2em;
}

.text ol {
    counter-reset: item;
}

.text ol > li {
    counter-increment: item;
    margin-bottom: 0.5em;
    position: relative;
    padding-left: 0.5em;
}

.text ol > li::before {
    content: counter(item) ".";
    font-weight: bold;
    position: absolute;
    left: -1.8em;
    width: 1.5em;
    text-align: right;
}

/* Вложенные списки */
.text ul ul, .text ol ol, .text ul ol, .text ol ul {
    margin: 0.5em 0;
    padding-left: 1.8em;
}

.text ul ul > li::before {
    content: "◦";
    color: #5dade2;
}

/* === ЦИТАТЫ И КОД === */
.text blockquote {
    border-left: 4px solid #3498db;
    margin: 1.8em 0;
    padding: 1.2em 1.8em;
    font-style: italic;
    position: relative;
    border-radius: 0 8px 8px 0;
}

/* Встроенный код */
.text code {
    background-color: #f8f9fa;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
    font-size: 0.9em;
    border: 1px solid #e9ecef;
}

/* Блочный код */
.text pre {
    background: linear-gradient(135deg, #2d3436 0%, #34495e 100%);
    padding: 1.4em;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
    font-size: 0.95em;
    line-height: 1.5;
    margin: 1.8em 0;
    border: 1px solid #404b5a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.text pre code {
    background: none;
    padding: 0;
    border: none;
    color: inherit;
    font-size: inherit;
}

/* === ССЫЛКИ === */
.text p > a {
    text-decoration: none;
    border-bottom: 1px solid rgba(41, 128, 185, 0.3);
    transition: all 0.2s ease;
    padding-bottom: 1px;
}

.text p > a:hover {
    border-bottom: 1px solid #1a5276;
    border-bottom-width: 2px;
}

/* === ИЗОБРАЖЕНИЯ === */
.text p > img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.8em auto;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.text img:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* Подписи к изображениям */
.text figure {
    margin: 2em 0;
    text-align: center;
}

.text figcaption {
    font-size: 0.9em;
    margin-top: 0.5em;
    font-style: italic;
}

/* === ТАБЛИЦЫ === */
.text table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.8em 0;
    font-size: 0.95em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.text th {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    font-weight: 600;
    text-align: left;
    padding: 1em 1.2em;
}

.text td {
    padding: 0.9em 1.2em;
    border-bottom: 1px solid #e9ecef;
}

.text tr:last-child td {
    border-bottom: none;
}

.text tr:nth-child(even) {
    background-color: #f8f9fa;
}

.text tr:hover {
    background-color: #e8f4fc;
}

/* === РАЗДЕЛИТЕЛИ === */
.text hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #bdc3c7, transparent);
    margin: 2.5em auto;
    width: 80%;
}

/* === ВЫДЕЛЕНИЕ ТЕКСТА === */
.text mark, .text ::selection {
    background-color: #fff3cd;
    padding: 0.1em 0.2em;
}

.text mark {
    background-color: #fff3cd;
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

/* === ПОДСТРОЧНЫЙ/НАДСТРОЧНЫЙ ИНДЕКС === */
.text sub, .text sup {
    font-size: 0.75em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

.text sup {
    top: -0.5em;
}

.text sub {
    bottom: -0.25em;
}

/* === АДРЕС === */
.text address {
    font-style: italic;
    margin: 1em 0;
}

.text small {
    font-size: 0.85em;
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 768px) {
    .text p, .text li, .text td, .text th {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    .text h1 { font-size: 1.8rem; }
    .text h2 { font-size: 1.6rem; }
    .text h3 { font-size: 1.4rem; }
    .text h4 { font-size: 1.2rem; }
    
    .text blockquote {
        padding: 1em;
        margin-left: 0.5em;
        margin-right: 0.5em;
    }
    
    .text pre {
        padding: 1em;
        font-size: 0.9em;
        border-radius: 6px;
    }
    
    .text table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}