/* Карточки статей / новостей */
.grid-articles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

#articles > .grid-articles {
    margin-top: 1rem;
}

.article-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--card-shadow-md);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.article-card-cover {
    display: block;
    overflow: hidden;
    position: relative;
    min-height: 200px;
    background-color: var(--color-bg-subtle, #e8f4f7);
    background-image: linear-gradient(110deg, var(--color-bg-subtle, #e8f4f7) 28%, var(--color-bg-muted, #b8dfe8) 48%, var(--color-bg-subtle, #e8f4f7) 68%);
    background-size: 220% 100%;
    animation: article-card-cover-shimmer 1.35s ease-in-out infinite;
}

.article-card-status-badge {
    position: absolute;
    left: 0.65rem;
    top: 0.65rem;
    z-index: 2;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(26, 74, 122, 0.92);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
}

.article-card--draft {
    opacity: 0.97;
}

.article-card-cover:has(.article-card-cover-img.is-loaded) {
    animation: none;
    background-image: none;
}

.article-card-cover img,
.article-card-cover-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.28s ease, transform 0.3s ease;
}

.article-card-cover-img.is-loaded {
    opacity: 1;
}

.article-card:hover .article-card-cover-img.is-loaded {
    transform: scale(1.03);
}

@keyframes article-card-cover-shimmer {
    0% {
        background-position: 120% 0;
    }
    100% {
        background-position: -120% 0;
    }
}

.article-card-body {
    padding: 1.1rem 1.15rem 1.15rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.article-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    margin: 0 0 0.45rem;
    line-height: 1.35;
    min-height: calc(1.05rem * 1.35 * 3);
}

.article-card-title a {
    color: var(--color-primary);
    text-decoration: none;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-card-title a:hover {
    color: var(--color-primary-light);
}

.article-card-category {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 0.65rem;
}

.article-card-excerpt {
    font-size: 0.88rem;
    color: var(--color-text);
    line-height: 1.5;
    margin: 0 0 0.85rem;
    flex: 1;
}

.article-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.85rem;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.article-card-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.article-card-meta-item i {
    color: var(--color-primary-light);
    width: 16px;
    text-align: center;
}

.article-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.82rem;
}

.article-card-rating {
    display: flex;
    align-items: center;
    gap: 0.1rem;
}

.article-card-rating .bi-star {
    color: var(--color-rating-star-empty, #c5cdd3);
    font-size: 0.95rem;
}

.article-card-rating .bi-star-fill {
    color: var(--color-rating-star, #f0b429);
    font-size: 0.95rem;
}

.article-card-rating-count {
    color: var(--color-text-muted);
    margin-left: 0.25rem;
}

.article-card-counters {
    display: flex;
    gap: 0.85rem;
    color: var(--color-text-muted);
}

.article-card-counters i {
    margin-right: 0.15rem;
}

.article-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
}

.article-card-share {
    display: flex;
    gap: 0.45rem;
}

.social-icon-svg {
    width: 1.1em;
    height: 1.1em;
    display: block;
    flex-shrink: 0;
}

.article-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #c5ccc6;
    border-radius: 6px;
    color: #4a5a4e;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.article-share-btn .bi {
    font-size: 1.12rem;
    line-height: 1;
}

.article-share-btn .social-icon-svg {
    width: 1.12rem;
    height: 1.12rem;
}

.article-share-btn--vk .social-icon-svg {
    width: 1.48rem;
    height: 1.48rem;
}

.article-share-btn:hover {
    background: #f5f2eb;
    border-color: #a8b5aa;
    color: var(--color-primary);
}

.btn-article-more {
    background: var(--color-primary);
    color: var(--color-on-primary);
    border: none;
    border-radius: 999px;
    padding: 0.45rem 1.2rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-article-more:hover {
    background: var(--color-primary-light);
    color: var(--color-on-primary);
}

.article-page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    font-size: 0.9rem;
    color: #6b7c6f;
    margin-bottom: 1rem;
}

.article-page-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

[data-theme="dark"] .article-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

[data-theme="dark"] .article-card-title a {
    color: var(--color-text);
}

[data-theme="dark"] .article-card-title a:hover {
    color: var(--color-primary-light);
}

[data-theme="dark"] .article-card-category,
[data-theme="dark"] .article-card-meta,
[data-theme="dark"] .article-card-counters,
[data-theme="dark"] .article-card-rating-count,
[data-theme="dark"] .article-page-meta {
    color: var(--color-text-muted);
}

[data-theme="dark"] .article-card-excerpt {
    color: var(--color-text);
}

[data-theme="dark"] .article-card-stats {
    border-top-color: var(--color-border);
}

[data-theme="dark"] .article-share-btn {
    background: var(--color-bg-subtle);
    border-color: var(--color-border);
    color: var(--color-text);
}

[data-theme="dark"] .article-share-btn:hover {
    background: rgba(110, 184, 212, 0.12);
    border-color: var(--color-primary-light);
    color: var(--color-primary-light);
}

.article-page-share {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.article-content {
    font-size: 1.3rem;
    line-height: 1.45;
    color: var(--color-text, #2f3439);
    word-wrap: break-word;
}

.article-content h2 {
    font-size: 1.6rem;
    margin: 1.25rem 0 0.75em;
}

.article-content h3 {
    font-size: 1.45rem;
    margin: 1.1rem 0 0.65em;
}

/* Абзацный отступ и выравнивание по ширине (если в админке не задано иное) */
.article-content p {
    margin: 0;
    text-indent: 1.5em;
    text-align: justify;
    text-align-last: left;
    hyphens: auto;
}

.article-content p[align="left"],
.article-content p[style*="text-align: left"],
.article-content p[style*="text-align:left"] {
    text-align: left;
    text-align-last: auto;
}

.article-content p[align="center"],
.article-content p[style*="text-align: center"],
.article-content p[style*="text-align:center"] {
    text-align: center;
    text-align-last: auto;
}

.article-content p[align="right"],
.article-content p[style*="text-align: right"],
.article-content p[style*="text-align:right"] {
    text-align: right;
    text-align-last: auto;
}

.article-content p[align="justify"],
.article-content p[style*="text-align: justify"],
.article-content p[style*="text-align:justify"] {
    text-align: justify;
}

.article-content p:has(> img:only-child),
.article-content p:has(> .article-inline-image:only-child),
.article-content p:empty {
    text-indent: 0;
}

.article-content::after {
    content: "";
    display: block;
    clear: both;
}

.article-content strong,
.article-content b {
    font-weight: 700;
}

.article-content em,
.article-content i {
    font-style: italic;
}

.article-content u,
.article-content [style*="underline"] {
    text-decoration: underline;
}

.article-content ul,
.article-content ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.35rem;
}

.article-content .article-inline-image {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.article-content .article-inline-image[data-width="10"] { width: 10% !important; }
.article-content .article-inline-image[data-width="20"] { width: 20% !important; }
.article-content .article-inline-image[data-width="30"] { width: 30% !important; }
.article-content .article-inline-image[data-width="40"] { width: 40% !important; }
.article-content .article-inline-image[data-width="50"] { width: 50% !important; }
.article-content .article-inline-image[data-width="60"] { width: 60% !important; }
.article-content .article-inline-image[data-width="70"] { width: 70% !important; }
.article-content .article-inline-image[data-width="80"] { width: 80% !important; }
.article-content .article-inline-image[data-width="90"] { width: 90% !important; }
.article-content .article-inline-image[data-width="100"] { width: 100% !important; }

.article-content .article-inline-image--left,
.article-content .article-inline-image--right {
    display: block;
}

.article-content .article-inline-image img {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    margin: 0;
    box-shadow: none;
    cursor: zoom-in;
    transition: transform 0.25s ease;
    transform-origin: center center;
}

.article-content figure {
    margin: 1rem 0;
}

.article-content > img,
.article-content p > img {
    cursor: zoom-in;
    transition: transform 0.25s ease;
    transform-origin: center center;
}

.article-content .article-inline-image img[data-zoom="1"],
.article-content > img[data-zoom="1"],
.article-content p > img[data-zoom="1"] {
    transform: scale(1.5);
    cursor: zoom-in;
}

.article-content .article-inline-image img[data-zoom="2"],
.article-content > img[data-zoom="2"],
.article-content p > img[data-zoom="2"] {
    transform: scale(2.25);
    cursor: zoom-out;
}

.article-content figcaption {
    font-size: 1.05rem;
    color: #667;
    margin-top: 0.4rem;
    text-align: center;
}

@media (max-width: 576px) {
    .grid-articles {
        grid-template-columns: 1fr;
    }
}

/* Блок «совет по месту / маршруту» */
.article-advice-block {
    margin: 0 0 1.25rem;
    padding: 0.15rem 0 0.15rem 1rem;
    border: none;
    border-left: 4px solid var(--article-advice-border, #1e6b33);
    background: transparent;
    color: var(--article-advice-text, #3d4a42);
    font-size: var(--article-advice-size, 1.05rem);
    font-family: var(--article-advice-font, inherit);
    line-height: 1.65;
}

/* Блок «лайфхак» в тексте */
.article-lifehack-block {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin: 1.5rem 0;
    padding: 1rem 1.1rem;
    background: var(--article-lifehack-bg, #f8f9fa);
    border: 1px solid #e3e7ea;
    border-left: 4px solid var(--article-lifehack-border, #1e6b33);
    border-radius: 0 8px 8px 0;
    color: var(--article-lifehack-text, #2f3439);
    font-size: var(--article-lifehack-size, 0.98rem);
    font-family: var(--article-lifehack-font, inherit);
    line-height: 1.6;
}

.article-lifehack-block__icon {
    color: var(--article-lifehack-label, #1e6b33);
    font-size: 1.15rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.article-lifehack-block__label {
    color: var(--article-lifehack-label, #1e6b33);
    margin-right: 0.35rem;
}

/* Кнопки реакций */
.article-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}

.article-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.95rem;
    border: 1px solid #d5ddd8;
    border-radius: 8px;
    background: #f7f8f8;
    color: #2f4f4f;
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.article-action-btn:hover {
    background: #eef4f1;
    border-color: #b8c9bf;
    color: var(--color-primary, #126B85);
}

.article-action-btn.is-active {
    background: #e8f4ef;
    border-color: #1e6b33;
    color: #1e6b33;
}

.article-action-btn i {
    font-size: 1rem;
}

.article-action-count {
    font-weight: 700;
}

.article-action-label {
    white-space: nowrap;
}

/* Панель статистики на странице статьи */
.article-stats-panel {
    background: #fff;
    border-radius: var(--radius-md, 16px);
    padding: 0.75rem 0.9rem;
    box-shadow: var(--card-shadow);
    border: 1px solid #e8ecef;
}

.article-stats-panel__title {
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 0.55rem;
}

.article-stats-panel__grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.45rem;
}

.article-stats-panel__item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 0;
    min-width: 0;
    padding: 0.4rem 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eef1f3;
}

.article-stats-panel__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 6px;
    background: rgba(18, 107, 133, 0.1);
    color: var(--color-primary, #126B85);
    font-size: 0.9rem;
}

.article-stats-panel__body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    line-height: 1.15;
}

.article-stats-panel__value {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary, #126B85);
}

.article-stats-panel__label {
    display: block;
    font-size: 0.65rem;
    color: #667;
    margin-top: 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

@media (max-width: 575px) {
    .article-stats-panel__grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.15rem;
    }

    .article-stats-panel__item {
        flex: 0 0 auto;
        min-width: 6.5rem;
    }
}

[data-theme="dark"] .article-advice-block {
    color: var(--color-text);
}

[data-theme="dark"] .article-lifehack-block {
    background: var(--color-bg-subtle);
    border-color: var(--color-border);
    color: var(--color-text);
}

[data-theme="dark"] .article-action-btn {
    background: var(--color-bg-subtle);
    border-color: var(--color-border);
    color: var(--color-text);
}

[data-theme="dark"] .article-action-btn.is-active {
    background: rgba(30, 107, 51, 0.2);
    border-color: #3d9a5a;
    color: #7fd99a;
}

[data-theme="dark"] .article-stats-panel {
    background: var(--color-surface);
    border-color: var(--color-border);
}

[data-theme="dark"] .article-stats-panel__item {
    background: var(--color-bg-subtle);
    border-color: var(--color-border);
}

[data-theme="dark"] .article-stats-panel__icon {
    background: rgba(110, 184, 212, 0.14);
    color: var(--color-primary-light);
}

[data-theme="dark"] .article-content figcaption,
[data-theme="dark"] .article-stats-panel__title,
[data-theme="dark"] .article-stats-panel__label {
    color: var(--color-text-muted);
}

[data-theme="dark"] .article-stats-panel__value {
    color: var(--color-text);
}

@media (max-width: 576px) {
    .article-action-bar {
        flex-direction: column;
    }

    .article-action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Предложенные маршруты пользователей */
.article-suggestions__title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0;
}

.article-suggestions__title-icon,
.article-suggestion-item__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(30, 107, 51, 0.12);
    color: #1e6b33;
    flex-shrink: 0;
}

.article-suggestions__title-icon {
    width: 1.85rem;
    height: 1.85rem;
    font-size: 1rem;
}

.article-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.article-suggestion-item {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0.95rem 1rem;
    border: 1px solid #dfe5e0;
    border-left: 4px solid #1e6b33;
    border-radius: 0 10px 10px 0;
    background: #f8faf9;
}

.article-suggestion-item__icon {
    font-size: 1.05rem;
    margin-top: 0.1rem;
}

.article-suggestion-item__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.35rem 1rem;
    margin-bottom: 0.35rem;
}

.article-suggestion-item__place {
    color: var(--color-primary, #126B85);
}

.article-suggestion-item__points {
    font-size: 0.92rem;
    color: var(--color-text, #2f3439);
}

.article-suggestion-item__comment {
    font-size: 0.88rem;
    color: #4a5a52;
    font-style: italic;
    padding-top: 0.35rem;
    border-top: 1px dashed #d8e0da;
    margin-top: 0.35rem !important;
}

.article-suggestion-item__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.75rem;
}

.article-suggestion-item__actions .btn {
    font-size: 0.82rem;
}

.article-suggestion-export-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-right: 0.35rem;
}

[data-theme="dark"] .article-suggestions__title-icon,
[data-theme="dark"] .article-suggestion-item__icon {
    background: rgba(127, 217, 154, 0.15);
    color: #7fd99a;
}

[data-theme="dark"] .article-suggestion-item {
    background: var(--color-bg-subtle);
    border-color: var(--color-border);
    border-left-color: #3d9a5a;
}

[data-theme="dark"] .article-suggestion-item__comment {
    color: var(--color-text-muted);
    border-top-color: var(--color-border);
}
