/* === СТИЛИ KOMORIUM (ЭНЦИКЛОПЕДИЯ) === */
.categories {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.cat-btn {
    flex: 1;
    min-width: 120px;
    padding: 1rem;
    background: var(--bg-surface);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    transition: all 0.2s;
}

.cat-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.category-section {
    margin-bottom: 2rem;
}

.category-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-light);
    color: var(--text-primary);
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.article-card {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.8rem;
    background: var(--bg-surface);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: 0 2px 8px var(--shadow-light);
    transition: all 0.2s;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.card-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.card-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-surface);
}

/* === СТИЛИ СТРАНИЦ СТАТЕЙ (КИТАЙ, БАЗАНОВО И ДР.) === */
.top-menu {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
}

.top-menu a {
    display: inline-block;
    padding: 12px 24px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 25px;
    background: var(--bg-surface);
    border: 2px solid var(--border-light);
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px var(--shadow-light);
}

.top-menu a:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.content-section {
    margin-bottom: 2rem;
}

.content-section h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.content-section p {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    text-align: justify;
    text-indent: 1.5em;
    margin-bottom: 1rem;
    hyphens: auto;
}

.content-section img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1rem 0;
    box-shadow: 0 2px 10px var(--shadow-light);
}

main > h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.table th, .table td {
    border: 1px solid var(--border-light);
    padding: 8px 12px;
    text-align: center;
}

.table th {
    background: var(--th-body);
    font-weight: bold;
}

.table tr:hover {
    background: var(--menu-hover);
}

/* === ПОДВАЛ === */
.footer {
    background: #2d3436;  /* оставляем тёмным, либо можно заменить на var(--footer-bg) */
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
}

.footer p {
    opacity: 0.8;
}

/* === СТИХИ И ЦИТАТЫ === */
.poem-block {
    background: var(--bg-surface);
    padding: 1.8rem 2rem;
    margin-bottom: 2rem;
    border-radius: 18px;
    box-shadow: 0 4px 12px var(--shadow-light);
    border: 1px solid var(--border-light);
}

.poem-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.poem-text {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.8;
    white-space: pre-wrap;
    font-style: normal;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    text-indent: 0;
}

.poem-date {
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px dashed var(--border-light);
    padding-top: 0.8rem;
    margin-top: 0.5rem;
}

.quote-badge {
    background: var(--bg-body);
    padding: 1.2rem 1.5rem;
    border-radius: 30px;
    border-left: 6px solid var(--accent);
    margin-bottom: 1rem;
    box-shadow: 0 2px 6px var(--shadow-light);
}

.photo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.photo-placeholder {
    width: 180px;
    height: 140px;
    background: linear-gradient(145deg, var(--bg-body), var(--bg-surface));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-weight: 500;
    box-shadow: 0 4px 8px var(--shadow-light);
    border: 1px solid var(--border-light);
}

.content-section .no-indent {
    text-indent: 0;
}

/* === СКРЫВАЕМЫЕ ПОДРАЗДЕЛЫ (Дзен-стиль) === */
.subcategory {
    margin-bottom: 1.5rem;
}

.subcategory-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.subcategory-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.toggle-subcat {
    background: var(--bg-surface);
    border: 2px solid var(--border-light);
    border-radius: 30px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
    box-shadow: 0 2px 5px var(--shadow-light);
    flex-shrink: 0;
}

.toggle-subcat:hover {
    border-color: var(--accent);
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.05);
}

.toggle-subcat .arrow {
    display: inline-block;
    transition: transform 0.3s;
}

.subcategory.collapsed .articles-grid {
    display: none;
}

.subcategory.collapsed .toggle-subcat .arrow {
    transform: rotate(-90deg);
}

.toggle-subcat .arrow {
    transform: rotate(0deg);
}

.category-section > h2 {
    margin-top: 2rem;
}

.category-section > h2:first-of-type {
    margin-top: 0;
}

.standalone-card {
    margin-bottom: 2rem;
}

/* === ПОИСК === */
.search-container {
    max-width: 600px;
    margin: 0 auto 2rem;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.9rem 3rem 0.9rem 1.5rem;
    font-size: 1rem;
    border: 2px solid var(--border-light);
    border-radius: 40px;
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 4px 12px var(--shadow-light);
    transition: border 0.2s, box-shadow 0.2s;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.search-clear {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 5px;
    display: none;
    line-height: 1;
    transition: color 0.2s;
}

.search-clear:hover {
    color: var(--text-primary);
}

.search-clear.visible {
    display: block;
}

.no-results-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--bg-surface);
    border-radius: 20px;
    margin: 1rem 0;
    display: none;
}

.no-results-message.show {
    display: block;
}

.article-card.hidden-by-search {
    display: none !important;
}

.subcategory.hidden-subcat {
    display: none;
}



/* Адаптивность для энциклопедии */
@media (max-width: 600px) {
    .categories {
        flex-direction: column;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .top-menu a {
        padding: 8px 16px;
        font-size: 13px;
    }
}


pre {
            background: var(--bg-body);
            border: 1px solid var(--border-light);
            border-radius: 12px;
            padding: 1.2rem;
            overflow-x: auto;
            margin: 1.5rem 0;
            font-family: 'Courier New', monospace;
            font-size: 0.95rem;
            line-height: 1.5;
            color: var(--text-primary);
        }
        code {
            font-family: 'Courier New', monospace;
            background: transparent;
            padding: 0;
        }
        :not(pre) > code {
            background: var(--bg-body);
            padding: 0.2rem 0.4rem;
            border-radius: 6px;
            border: 1px solid var(--border-light);
            font-size: 0.9em;
        }
        .content-section h3 {
            margin-top: 1.8rem;
            margin-bottom: 0.8rem;
            color: var(--accent);
        }
        .content-section h4 {
            margin-top: 1.5rem;
            margin-bottom: 0.5rem;
            font-weight: 600;
        }
        .toc {
            background: var(--bg-surface);
            border-radius: 16px;
            padding: 1.5rem;
            margin-bottom: 2rem;
            border: 1px solid var(--border-light);
        }
        .toc h3 {
            margin-top: 0;
            margin-bottom: 1rem;
        }
        .toc ul {
            list-style: none;
            padding-left: 0;
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 0.5rem;
        }
        .toc a {
            color: var(--accent);
            text-decoration: none;
        }
        .toc a:hover {
            text-decoration: underline;
        }
        @media (max-width: 600px) {
            pre {
                padding: 0.8rem;
                font-size: 0.85rem;
            }
        }