/* ============================================================
   CleanLabel.Life — 03-content.css
   Карточка добавки, sidebar, article, article-body, sources
   ============================================================ */

/* ---------- HERO КАРТОЧКИ ДОБАВКИ ---------- */
.hero-main {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 26px;
    padding: 34px;
}

.page-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 28px;
    margin-bottom: 25px;
}

.hero-canonical {
    font-size: 15px;
    color: var(--muted);
    margin: 4px 0 8px;
    line-height: 1.4;
    font-weight: 500;
}

.hero-main .e-badge,
.e-badge {
    display: inline-flex;
    padding: 7px 11px;
    background: var(--green-soft);
    color: var(--green);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 850;
    margin-bottom: 18px;
}

.hero-main h1 {
    font-size: clamp(36px, 5vw, 54px);
    line-height: 1.02;
    letter-spacing: -2.5px;
    margin-bottom: 10px;
}

.hero-subtitle {
    color: var(--muted);
    font-size: 18px;
    margin-bottom: 25px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tag {
    padding: 6px 10px;
    background: #f1f4f2;
    border-radius: 8px;
    color: #65736c;
    font-size: 11px;
}

/* ---------- STATUS CARD ---------- */
.status-card {
    background: var(--green);
    border-radius: 26px;
    padding: 27px;
    box-shadow: var(--shadow);
}

.status-label {
    color: #b8d0c5;
    font-size: 11px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.status-title {
    font-size: 25px;
    font-weight: 850;
    margin-bottom: 22px;
}

.status-row {
    padding: 13px 0;
    border-top: 1px solid rgba(255, 255, 255, .13);
    display: flex;
    justify-content: space-between;
    gap: 15px;
    font-size: 12px;
}

.status-row span:first-child { color: #b7c9c1; }
.status-ok { color: var(--lime); font-weight: 800; }

/* ---------- QUICK FACTS ---------- */
.quick-facts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 35px;
}

.fact {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 17px;
    padding: 17px 18px;
}

.fact-label {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 5px;
}

.fact-value {
    font-size: 14px;
    font-weight: 750;
}

/* ---------- CONTENT КАРТОЧКИ ДОБАВКИ ---------- */
.content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
}

.content-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 28px;
    margin-bottom: 15px;
}

.content-card h2 { font-size: 23px; letter-spacing: -.7px; margin-bottom: 17px; }
.content-card h3 { font-size: 16px; margin-top: 25px; margin-bottom: 9px; }
.content-card p  { color: #52615a; font-size: 14px; margin-bottom: 13px; }
.content-card ul, .content-card ol { margin-left: 18px; color: #52615a; font-size: 14px; }
.content-card li { margin-bottom: 7px; }

.health-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.health-box { border-radius: 17px; padding: 20px; }
.health-positive { background: #edf7e8; }
.health-attention { background: var(--yellow-soft); }
.health-box-title { font-size: 12px; font-weight: 850; margin-bottom: 8px; }
.health-box p { color: #53625a; font-size: 13px; }

/* ---------- HEALTH BOX — полный текст ---------- */
.health-box-text {
    font-size: 13px;
    line-height: 1.65;
    color: #53625a;
}

.health-box-text p {
    margin: 0 0 10px;
}

.health-box-text p:last-child {
    margin-bottom: 0;
}

.health-box-text ul {
    margin: 8px 0 10px 18px;
    padding: 0;
}

.health-box-text li {
    margin-bottom: 5px;
    font-size: 13px;
}

/* ---------- HEALTH BOX — сворачивание длинного текста ---------- */
.health-box-text {
    position: relative;
    overflow: hidden;
    max-height: 2000px;          /* раскрытое состояние */
    transition: max-height .35s ease;
}

.health-box-text.is-collapsed {
    max-height: 240px;           /* свёрнутое состояние */
}

/* Градиент-затухание внизу, когда свёрнуто (под цвет .health-positive) */
.health-box-text.is-collapsed::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 70px;
    background: linear-gradient(
        to bottom,
        rgba(237, 247, 232, 0) 0%,
        rgba(237, 247, 232, 1) 90%
    );
    pointer-events: none;
}

/* Кнопка «Показать полностью / Свернуть» */
.health-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 7px 14px;
    background: #fff;
    color: var(--green);
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.health-toggle:hover {
    background: var(--green-soft);
    border-color: var(--green);
    color: var(--green-dark);
}

.health-toggle::after {
    content: "↓";
    font-size: 13px;
    line-height: 1;
    transition: transform .2s ease;
}

.health-toggle.is-open::after {
    transform: rotate(180deg);
}

/* ---------- FAQ — полный текст ---------- */
.faq-ai .faq-answer {
    margin: 10px 0 0 22px;
    color: var(--muted, #6b7280);
    line-height: 1.7;
    font-size: 14px;
}

.faq-ai .faq-answer p {
    margin: 0 0 10px;
}

.faq-ai .faq-answer p:last-child {
    margin-bottom: 0;
}

.faq-ai .faq-answer ul {
    margin: 8px 0 10px 18px;
    padding: 0;
}

.faq-ai .faq-answer li {
    margin-bottom: 5px;
}

.use-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.use-list li {
    background: #f7faf8;
    border-radius: 12px;
    padding: 12px;
    font-size: 12px;
}

/* ---------- SIDEBAR ---------- */
.sidebar-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
    margin-bottom: 14px;
}

.sidebar-card h3 { font-size: 15px; margin-bottom: 14px; }
.sidebar-card p  { color: var(--muted); font-size: 12px; line-height: 1.65; }

.additive-image-preview {
    margin: 0 0 16px;
    border-radius: 12px;
    overflow: hidden;
    background: #f7faf8;
    border: 1px solid var(--border);
}

.additive-image-preview img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: contain;
}

.info-list { list-style: none; }

.info-list li {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.info-list li:last-child { border-bottom: 0; }
.info-list span:first-child { color: var(--muted); }
.info-list strong { text-align: right; }

.toc { list-style: none; }
.toc li { border-bottom: 1px solid var(--border); }
.toc li:last-child { border-bottom: 0; }
.toc a { display: block; padding: 10px 0; color: var(--muted); font-size: 12px; }
.toc a:hover { color: var(--green); }

/* ---------- ARTICLE ---------- */
.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 760px) 280px;
    gap: 30px;
    align-items: start;
}

.article {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 26px;
    overflow: hidden;
    box-shadow: 0 8px 35px rgba(23, 76, 59, .04);
}

.article-header {
    padding: 40px 44px 32px;
    border-bottom: 1px solid var(--border);
}

.article-label {
    display: inline-flex;
    padding: 7px 11px;
    background: var(--green-soft);
    color: var(--green);
    border-radius: 9px;
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 18px;
}

.article h1,
.article-header h1 {
    font-size: clamp(36px, 5vw, 54px);
    line-height: 1.04;
    letter-spacing: -2.5px;
    margin-bottom: 18px;
}

.article-intro { color: var(--muted); font-size: 17px; line-height: 1.55; }
.article-meta  { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.meta {
    padding: 6px 10px;
    background: #f2f5f3;
    color: #65736c;
    border-radius: 8px;
    font-size: 11px;
}

.article-body { padding: 35px 44px 45px; }
.article-body h2 { margin-top: 38px; margin-bottom: 15px; font-size: 27px; line-height: 1.15; letter-spacing: -.9px; }
.article-body h2:first-child { margin-top: 0; }
.article-body h3 { margin-top: 27px; margin-bottom: 10px; font-size: 18px; }
.article-body p  { margin-bottom: 16px; color: #4f5e57; font-size: 15px; }
.article-body ul { margin: 15px 0 20px 20px; color: #4f5e57; font-size: 14px; }
.article-body li { margin-bottom: 8px; }

.additive-link {
    color: var(--green);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: rgba(23, 76, 59, .35);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    padding: 0 1px;
    border-radius: 3px;
    transition: background .15s, color .15s, text-decoration-color .15s;
}

.additive-link:hover {
    color: var(--green-dark);
    background: var(--green-soft);
    text-decoration-color: var(--green);
}

.facts {
    padding: 24px 44px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    background: #fbfcfb;
    border-bottom: 1px solid var(--border);
}

.facts .fact { padding: 13px; border-radius: 12px; background: #fff; border: 1px solid var(--border); }
.facts .fact-label { font-size: 9px; font-weight: 800; letter-spacing: .6px; }
.facts .fact-value { font-size: 12px; font-weight: 750; }

/* ---------- SOURCES ---------- */
.sources { margin-top: 35px; padding-top: 27px; border-top: 1px solid var(--border); }
.sources h2 { margin-top: 0; }

.source {
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.source:last-child { border-bottom: 0; }
.source-name { font-size: 13px; font-weight: 750; }
.source-description,
.source-type { color: var(--muted); font-size: 11px; margin-top: 3px; }
.source-link,
.source a { color: var(--green); font-size: 11px; font-weight: 800; white-space: nowrap; }

/* ---------- ARTICLES LIST ---------- */
.articles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.article-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 19px;
    padding: 20px;
    transition: .2s;
}

.article-card:hover,
article.article:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.article-type {
    color: var(--green);
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 12px;
}

.article-card h2,
.article-card h3 {
    font-size: 16px;
    line-height: 1.25;
    margin-bottom: 8px;
    letter-spacing: -.3px;
}

.article-card p { color: var(--muted); font-size: 12px; margin-bottom: 15px; }
.article-link  { color: var(--green); font-size: 11px; font-weight: 800; }

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 17px;
}

.section-heading h2 { font-size: 25px; letter-spacing: -.8px; }
.section-heading a  { color: var(--green); font-size: 12px; font-weight: 800; }

/* ============================================================
   АДМИН-КНОПКИ В ПУБЛИЧНОЙ ЧАСТИ
   ============================================================ */

.admin-floating-edit {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--green);
    color: #fff !important;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(23, 76, 59, .25);
    transition: transform .15s, box-shadow .15s, background .15s;
}

.admin-floating-edit:hover {
    background: var(--green-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(23, 76, 59, .35);
    color: #fff !important;
}

.admin-floating-edit span {
    font-size: 16px;
    line-height: 1;
}

.admin-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 800;
    color: var(--green) !important;
    background: var(--green-soft);
    border: 1px solid rgba(23, 76, 59, .15);
    border-radius: 7px;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
    line-height: 1.3;
    cursor: pointer;
}

.admin-edit-btn:hover {
    background: var(--green);
    color: #fff !important;
    border-color: var(--green);
}

.admin-edit-btn--icon {
    padding: 3px 7px;
    font-size: 12px;
    line-height: 1;
}

.admin-edit-btn--alt {
    background: #fff7df;
    color: #8a6a1f !important;
    border-color: #f0cd80;
}

.admin-edit-btn--alt:hover {
    background: #8a6a1f;
    color: #fff !important;
    border-color: #8a6a1f;
}

.admin-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    align-items: center;
}

/* Позиционирование иконки «✎» в карточках статей и добавок */
.article-card,
.additive-card {
    position: relative;
}

.article-card > .admin-edit-btn,
.article-card .admin-edit-btn--icon,
.additive-card > .admin-edit-btn,
.additive-card .admin-edit-btn--icon {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
}

/* ============================================================
   АДАПТИВ КАРТОЧКИ ДОБАВКИ
   ============================================================ */

@media (max-width: 900px) {
    .page-hero {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .content,
    .article-layout {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .quick-facts {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar {
        position: static;
        top: auto;
    }

    .facts {
        padding: 20px 22px;
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 600px) {
    .hero-main {
        padding: 22px 20px;
        border-radius: 18px;
    }

    .hero-main h1 {
        font-size: 32px;
        letter-spacing: -1.2px;
    }

    .hero-subtitle {
        font-size: 14px;
        margin-bottom: 16px;
    }

    .status-card {
        padding: 20px;
        border-radius: 18px;
    }

    .status-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .quick-facts {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 24px;
    }

    .fact {
        padding: 14px 16px;
    }

    .content-card {
        padding: 20px;
        border-radius: 16px;
    }

    .content-card h2 {
        font-size: 19px;
    }
}

/* ---------- Markdown-элементы в контенте ---------- */

.ingredients-text blockquote,
.content-card blockquote {
    margin: 14px 0;
    padding: 12px 16px;
    background: #fff8e5;
    border-left: 3px solid #e08c00;
    border-radius: 8px;
    color: #5a4a1f;
    font-size: 13px;
    line-height: 1.6;
}

.ingredients-text blockquote p,
.content-card blockquote p {
    margin: 0;
}

.ingredients-text table,
.content-card table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 13px;
    background: #fff;
}

.ingredients-text table th,
.ingredients-text table td,
.content-card table th,
.content-card table td {
    padding: 8px 12px;
    border: 1px solid #e8efeb;
    text-align: left;
    vertical-align: top;
}

.ingredients-text table th,
.content-card table th {
    background: #f7faf8;
    font-weight: 800;
    color: var(--text);
}

.ingredients-text table tbody tr:nth-child(even),
.content-card table tbody tr:nth-child(even) {
    background: #fafcfb;
}

.ingredients-text hr,
.content-card hr {
    border: 0;
    border-top: 1px solid #e8efeb;
    margin: 18px 0;
}

.ingredients-text code,
.content-card code {
    padding: 2px 6px;
    background: #eef3f0;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: #52615a;
}

/* Вложенные списки */
.ingredients-text ul ul,
.ingredients-text ol ol,
.ingredients-text ul ol,
.ingredients-text ol ul,
.content-card ul ul,
.content-card ol ol,
.content-card ul ol,
.content-card ol ul {
    margin: 4px 0 4px 20px;
    padding-left: 20px;
}

.ingredients-text ul li,
.ingredients-text ol li,
.content-card ul li,
.content-card ol li {
    margin: 4px 0;
}