/*
 * ck_content.css — общие стили для CKEditor-контента
 * Используется в блоге (.article-content) и в продуктах (.product-description).
 * Подключать вместо article_content.css / product_content.css.
 *
 * Размещение: static/core/css/ck_content.css  (или аналогичное shared-место)
 */

/* ===== Базовый контейнер ===== */
.article-content,
.product-description {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
}

/* ===== Заголовки ===== */
.article-content h1, .product-description h1,
.article-content h2, .product-description h2,
.article-content h3, .product-description h3,
.article-content h4, .product-description h4,
.article-content h5, .product-description h5,
.article-content h6, .product-description h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
}
.article-content h1, .product-description h1 { font-size: 2rem; }
.article-content h2, .product-description h2 { font-size: 1.75rem; }
.article-content h3, .product-description h3 { font-size: 1.5rem; }
.article-content h4, .product-description h4 { font-size: 1.25rem; }
.article-content h5, .product-description h5 { font-size: 1.1rem; }
.article-content h6, .product-description h6 { font-size: 1rem; }

/* ===== Абзацы ===== */
.article-content p,
.product-description p {
    margin-bottom: 1.2em;
}

/* ===== Списки ===== */
.article-content ul, .product-description ul,
.article-content ol, .product-description ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}
.article-content li,
.product-description li {
    margin-bottom: 0.3rem;
}

/* ===== Цитаты ===== */
.article-content blockquote,
.product-description blockquote {
    border-left: 4px solid var(--primary);
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    margin: 1.25rem 0;
    font-style: italic;
    color: var(--text-secondary);
}

/* ===== Горизонтальная линия ===== */
.article-content hr,
.product-description hr {
    border: none;
    border-top: 2px solid var(--border-light);
    margin: 2em 0;
}

/* ===== Таблицы ===== */
.article-content table,
.product-description table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.95rem;
}
.article-content th, .product-description th,
.article-content td, .product-description td {
    border: 1px solid var(--border-light);
    padding: 0.6rem 0.8rem;
    text-align: left;
}
.article-content th,
.product-description th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
}
.article-content tr:nth-child(even),
.product-description tr:nth-child(even) {
    background: var(--bg-secondary);
}

/* ===== Изображения ===== */
.article-content img,
.product-description img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: var(--radius-sm, 4px);
}

/* CKEditor 5: figure.image */
.article-content figure.image,
.product-description figure.image {
    display: inline-block;
    margin: 1em 0;
    max-width: 100%;
}
.article-content figure.image img,
.product-description figure.image img {
    max-width: 100%;
    height: auto;
}
.article-content figure.image figcaption,
.product-description figure.image figcaption {
    text-align: center;
    font-size: 0.88em;
    color: var(--text-light);
    margin-top: 0.4em;
}

/* Выравнивание изображений (классы CKEditor 5) */
.article-content .image-style-align-left,
.product-description .image-style-align-left {
    float: left;
    margin-right: 1.5em;
    margin-bottom: 1em;
    max-width: 50%;
}
.article-content .image-style-align-right,
.product-description .image-style-align-right {
    float: right;
    margin-left: 1.5em;
    margin-bottom: 1em;
    max-width: 50%;
}
.article-content .image-style-align-center,
.product-description .image-style-align-center {
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
}

/* clearfix после float-изображений */
.article-content::after,
.product-description::after {
    content: '';
    display: table;
    clear: both;
}

/* ===== Встроенное видео (iframe/media) ===== */
.article-content .media,
.product-description .media {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    margin: 1.5em 0;
}
.article-content .media iframe,
.product-description .media iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--radius-sm, 4px);
}

/* ===== Блоки кода ===== */
.article-content pre,
.product-description pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm, 4px);
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.9em;
    line-height: 1.5;
}
.article-content code,
.product-description code {
    font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
    background: var(--bg-secondary);
    color: var(--primary);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.88em;
}
.article-content pre code,
.product-description pre code {
    padding: 0;
    background: none;
    color: inherit;
}

/* ===== Ссылки внутри контента ===== */
.article-content a,
.product-description a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.15s;
}
.article-content a:hover,
.product-description a:hover {
    opacity: 0.75;
}

/* ===== Адаптивность ===== */
@media (max-width: 600px) {
    .article-content .image-style-align-left,
    .article-content .image-style-align-right,
    .product-description .image-style-align-left,
    .product-description .image-style-align-right {
        float: none;
        max-width: 100%;
        margin: 1em 0;
    }

    .article-content table,
    .product-description table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

