/*
|--------------------------------------------------------------------------
| Отдельная статья — /articles/{slug}
|--------------------------------------------------------------------------
| Самодостаточный стиль страницы.
| Не требует information.css или articles.css.
| Общие кнопки .btn остаются в системных стилях.
|--------------------------------------------------------------------------
*/

.article-page-shell,
.article-page-shell * {
    box-sizing: border-box;
}

.article-page-shell {
    width: 100%;
    min-width: 0;
    margin: 0 0 56px;
}

/* Шапка */

.article-detail-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(20px, 4vw, 48px);

    min-height: 220px;
    margin-bottom: 18px;
    padding: clamp(26px, 4vw, 44px);

    border: 1px solid var(--border, #d9e0ea);
    border-radius: 21px;

    background:
        radial-gradient(
            circle at 90% 15%,
            rgb(37 99 235 / 14%),
            transparent 38%
        ),
        var(--surface, #ffffff);

    box-shadow: 0 12px 32px rgb(15 23 42 / 5%);
}

.article-detail-hero::before {
    position: absolute;
    z-index: -1;
    right: -75px;
    bottom: -135px;

    width: 300px;
    height: 300px;

    border: 1px solid rgb(37 99 235 / 12%);
    border-radius: 50%;

    content: "";
    pointer-events: none;
}

.article-detail-hero-content {
    min-width: 0;
    max-width: 860px;
}

.article-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    min-height: 34px;
    margin-bottom: 17px;

    color: var(--text-soft, #64748b);

    font-size: 0.84rem;
    font-weight: 750;
    text-decoration: none;
}

.article-detail-back:hover {
    color: var(--primary, #2563eb);
}

.article-detail-back:focus-visible {
    border-radius: 3px;
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 3px;
}

.article-detail-hero .eyebrow,
.article-rating-card .eyebrow,
.article-comments-heading .eyebrow {
    margin: 0 0 9px;

    color: var(--primary, #2563eb);

    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    line-height: 1.4;
    text-transform: uppercase;
}

.article-detail-hero h1 {
    margin: 0;

    color: var(--text, #172033);

    font-size: clamp(2rem, 4.5vw, 3.45rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1.12;

    overflow-wrap: anywhere;
}

.article-detail-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;

    margin-top: 19px;
}

.article-detail-meta > span,
.article-detail-meta > time {
    display: inline-flex;
    align-items: center;

    max-width: 100%;
    min-height: 29px;
    padding: 5px 9px;

    border: 1px solid var(--border, #d9e0ea);
    border-radius: 999px;

    background: var(--bg-soft, #eff6ff);
    color: var(--text-soft, #64748b);

    font-size: 0.77rem;
    font-weight: 700;
    line-height: 1.4;
}

.article-detail-hero-symbol {
    display: grid;
    flex: 0 0 auto;
    place-items: center;

    width: clamp(80px, 11vw, 116px);
    aspect-ratio: 1;

    border: 1px solid rgb(37 99 235 / 24%);
    border-radius: 25px;

    background: var(--bg-soft, #eff6ff);
    color: var(--primary, #2563eb);

    font-size: clamp(2.1rem, 4vw, 3.1rem);
    line-height: 1;

    box-shadow: 0 15px 28px rgb(37 99 235 / 9%);
    transform: rotate(-6deg);
}

/* Уведомления */

.article-feedback {
    margin: 0 0 18px;
    padding: 12px 15px;

    border: 1px solid var(--border, #d9e0ea);
    border-radius: 11px;

    background: var(--surface, #ffffff);
    color: var(--text, #172033);

    font-size: 0.9rem;
    line-height: 1.55;
}

.article-feedback-success {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.article-feedback-error {
    border-color: #fecaca;
    background: #fff1f2;
    color: #b91c1c;
}

/* Содержимое и правая колонка */

.article-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
    align-items: start;
    gap: 18px;
}

.article-main-column,
.article-sidebar {
    min-width: 0;
}

.article-body-card,
.article-rating-card,
.article-comments-card {
    min-width: 0;

    border: 1px solid var(--border, #d9e0ea);
    border-radius: 18px;

    background: var(--surface, #ffffff);
    box-shadow: 0 9px 25px rgb(15 23 42 / 4%);
}

.article-body-card {
    overflow: hidden;
}

.article-detail-cover {
    overflow: hidden;

    margin: 0;

    border-bottom: 1px solid var(--border, #d9e0ea);

    background: var(--bg-soft, #eff6ff);
}

.article-detail-cover img {
    display: block;

    width: 100%;
    max-height: 490px;

    object-fit: cover;
    object-position: center;
}

.article-detail-content {
    min-width: 0;
    padding: clamp(22px, 3.7vw, 38px);

    color: var(--text, #172033);

    font-size: 1rem;
    line-height: 1.8;

    white-space: normal;
    overflow-wrap: anywhere;
}

.article-detail-content > :first-child {
    margin-top: 0;
}

.article-detail-content > :last-child {
    margin-bottom: 0;
}

.article-detail-content h1,
.article-detail-content h2,
.article-detail-content h3,
.article-detail-content h4 {
    color: var(--text, #172033);

    font-weight: 800;
    line-height: 1.3;
}

.article-detail-content h2 {
    margin: 36px 0 14px;
    font-size: clamp(1.5rem, 2.8vw, 1.9rem);
}

.article-detail-content h3 {
    margin: 29px 0 12px;
    font-size: clamp(1.25rem, 2.2vw, 1.45rem);
}

.article-detail-content h4 {
    margin: 24px 0 10px;
    font-size: 1.1rem;
}

.article-detail-content p,
.article-detail-content ul,
.article-detail-content ol {
    margin: 0 0 19px;
}

.article-detail-content ul,
.article-detail-content ol {
    padding-left: 1.55em;
}

.article-detail-content li + li {
    margin-top: 7px;
}

.article-detail-content a {
    color: var(--primary, #2563eb);

    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.article-detail-content a:hover {
    color: var(--primary-hover, #1d4ed8);
}

.article-detail-content a:focus-visible {
    border-radius: 2px;
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 3px;
}

.article-detail-content blockquote {
    margin: 25px 0;
    padding: 15px 19px;

    border-left: 3px solid var(--primary, #2563eb);
    border-radius: 0 10px 10px 0;

    background: var(--bg-soft, #eff6ff);
    color: var(--text, #334155);
}

.article-detail-content img,
.article-detail-content video,
.article-detail-content iframe {
    max-width: 100%;
}

.article-detail-content img,
.article-detail-content video {
    display: block;
    height: auto;

    margin: 25px auto;
    border-radius: 10px;
}

.article-detail-content pre,
.article-detail-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

.article-detail-content pre {
    padding: 16px;
    border-radius: 10px;

    background: #172033;
    color: #e2e8f0;
}

.article-detail-content code {
    padding: 2px 5px;

    border-radius: 4px;

    background: var(--bg-soft, #f1f5f9);
    color: var(--text, #334155);

    font-family: Consolas, "Liberation Mono", monospace;
    font-size: 0.9em;
}

.article-detail-content pre code {
    padding: 0;

    background: transparent;
    color: inherit;

    font-size: inherit;
}

/* Рейтинг */

.article-sidebar {
    display: grid;
    align-content: start;
    gap: 16px;
}

.article-rating-card {
    padding: 24px;
}

.article-rating-icon {
    display: grid;
    place-items: center;

    width: 42px;
    height: 42px;
    margin-bottom: 15px;

    border: 1px solid rgb(37 99 235 / 14%);
    border-radius: 11px;

    background: var(--bg-soft, #eff6ff);
    color: var(--primary, #2563eb);

    font-size: 1.3rem;
}

.article-rating-card h2 {
    margin: 0;

    color: var(--text, #172033);

    font-size: 1.3rem;
    line-height: 1.3;
}

.article-rating-summary {
    display: flex;
    align-items: baseline;
    gap: 7px;

    margin-top: 19px;
}

.article-rating-summary strong {
    color: var(--primary, #2563eb);

    font-size: 2.6rem;
    line-height: 1;
}

.article-rating-summary span {
    color: var(--text-soft, #64748b);
    font-size: 0.9rem;
}

.article-rating-description {
    margin: 8px 0 17px;

    color: var(--text-soft, #64748b);

    font-size: 0.85rem;
    line-height: 1.55;
}

.article-rating-stars {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.article-rating-stars button {
    display: grid;
    place-items: center;

    width: 39px;
    height: 42px;
    padding: 0;

    border: 0;
    border-radius: 8px;

    background: transparent;
    color: var(--text-faint, #94a3b8);

    font: inherit;
    font-size: 1.75rem;
    line-height: 1;

    cursor: pointer;

    transition:
        background-color 160ms ease,
        color 160ms ease;
}

.article-rating-stars button:hover,
.article-rating-stars button.is-selected {
    background: var(--bg-soft, #eff6ff);
    color: var(--primary, #2563eb);
}

.article-rating-stars button:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}

.article-rating-hint {
    margin: 14px 0 0;

    color: var(--text-faint, #94a3b8);

    font-size: 0.77rem;
    line-height: 1.5;
}

.article-rating-login {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    margin-top: 18px;
    padding: 10px 12px;

    border: 1px solid rgb(37 99 235 / 15%);
    border-radius: 10px;

    background: var(--bg-soft, #eff6ff);
    color: var(--primary, #2563eb);

    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
}

.article-rating-login:hover {
    border-color: var(--primary, #2563eb);
}

.article-rating-login:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 3px;
}

.article-sidebar-statistics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;

    border: 1px solid var(--border, #d9e0ea);
    border-radius: 14px;

    background: var(--surface, #ffffff);
}

.article-statistic {
    display: flex;
    align-items: center;
    gap: 9px;

    min-width: 0;
    padding: 15px 12px;
}

.article-statistic + .article-statistic {
    border-left: 1px solid var(--border, #d9e0ea);
}

.article-statistic-icon {
    flex: 0 0 auto;

    color: var(--primary, #2563eb);
    font-size: 1.2rem;
}

.article-statistic strong,
.article-statistic span:last-child {
    display: block;
}

.article-statistic strong {
    color: var(--text, #172033);

    font-size: 0.95rem;
    line-height: 1.25;
}

.article-statistic span:last-child {
    margin-top: 2px;

    color: var(--text-soft, #64748b);

    font-size: 0.7rem;
    line-height: 1.35;
}

/* Комментарии: форма сверху, лента снизу */

.article-comments-card {
    margin-top: 18px;
    padding: clamp(20px, 3vw, 30px);
}

.article-comments-heading {
    padding-bottom: 18px;

    border-bottom: 1px solid var(--border, #d9e0ea);
}

.article-comments-heading h2 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;

    margin: 0;

    color: var(--text, #172033);

    font-size: 1.5rem;
    line-height: 1.3;
}

.article-comments-heading h2 span {
    display: inline-grid;
    place-items: center;

    min-width: 27px;
    min-height: 27px;
    padding: 0 7px;

    border-radius: 999px;

    background: var(--bg-soft, #eff6ff);
    color: var(--primary, #2563eb);

    font-size: 0.8rem;
}

.article-comments-heading p:last-child {
    margin: 8px 0 0;

    color: var(--text-soft, #64748b);

    font-size: 0.87rem;
    line-height: 1.6;
}

.article-comment-form {
    display: grid;
    gap: 13px;

    margin-top: 18px;
    padding: clamp(15px, 2.5vw, 20px);

    border: 1px solid var(--border, #d9e0ea);
    border-radius: 13px;

    background: var(--bg-soft, #f8fafc);
}

.article-form-field {
    display: block;
}

.article-form-field > span {
    display: block;

    margin-bottom: 7px;

    color: var(--text, #172033);

    font-size: 0.84rem;
    font-weight: 700;
}

.article-form-field input,
.article-form-field textarea {
    display: block;

    width: 100%;
    min-width: 0;

    border: 1px solid var(--border, #d9e0ea);
    border-radius: 9px;

    background: var(--surface, #ffffff);
    color: var(--text, #172033);

    font: inherit;
    font-size: 0.88rem;
}

.article-form-field input {
    max-width: 380px;
    min-height: 39px;
    padding: 8px 11px;
}

.article-form-field textarea {
    min-height: 90px;
    padding: 10px 11px;

    line-height: 1.5;
    resize: vertical;
}

.article-form-field input:focus-visible,
.article-form-field textarea:focus-visible {
    border-color: var(--primary, #2563eb);
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}

/* Эмодзи движка: только оформление, без изменения JS. */

.article-comment-emoji {
    display: grid;
    gap: 8px;
}

.article-comment-emoji-label {
    color: var(--text-soft, #64748b);

    font-size: 0.78rem;
    font-weight: 700;
}

.article-comment-emoji .emoji-picker-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;

    max-height: 90px;
    overflow-y: auto;
}

.article-comment-emoji .emoji-picker-item {
    display: grid;
    place-items: center;

    width: 33px;
    height: 33px;
    padding: 0;

    border: 1px solid var(--border, #d9e0ea);
    border-radius: 8px;

    background: var(--surface, #ffffff);
    color: var(--text, #172033);

    font: inherit;
    font-size: 1.13rem;
    line-height: 1;

    cursor: pointer;
}

.article-comment-emoji .emoji-picker-item:hover {
    border-color: var(--primary, #2563eb);

    background: var(--bg-soft, #eff6ff);
}

.article-comment-emoji .emoji-picker-item:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}

.article-comment-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 11px;
}

.article-comment-form-footer > span {
    color: var(--text-soft, #64748b);

    font-size: 0.77rem;
    line-height: 1.45;
}

.article-comments-feed {
    margin-top: 25px;
    padding-top: 23px;

    border-top: 1px solid var(--border, #d9e0ea);
}

.article-comments-feed > h3 {
    margin: 0 0 15px;

    color: var(--text, #172033);

    font-size: 1.08rem;
    line-height: 1.3;
}

.article-comments-list {
    display: grid;
    gap: 12px;
}

.article-comment {
    display: flex;
    align-items: flex-start;
    gap: 13px;

    min-width: 0;
    padding: 17px;

    border: 1px solid var(--border, #d9e0ea);
    border-radius: 12px;

    background: var(--bg-soft, #f8fafc);
}

.article-comment-avatar {
    display: grid;
    flex: 0 0 40px;
    place-items: center;

    width: 40px;
    height: 40px;

    border: 1px solid rgb(37 99 235 / 14%);
    border-radius: 50%;

    background: var(--surface, #ffffff);
    color: var(--primary, #2563eb);

    font-size: 0.98rem;
    font-weight: 800;
}

.article-comment-content {
    flex: 1;
    min-width: 0;
}

.article-comment-meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 7px 11px;
}

.article-comment-meta strong {
    color: var(--text, #172033);

    font-size: 0.91rem;
}

.article-comment-meta time {
    color: var(--text-faint, #94a3b8);

    font-size: 0.75rem;
}

.article-comment-text {
    margin-top: 8px;

    color: var(--text, #334155);

    font-size: 0.9rem;
    line-height: 1.7;

    white-space: normal;
    overflow-wrap: anywhere;
}

.article-comments-empty {
    padding: 30px 20px;

    border: 1px dashed var(--border-strong, #b8c5d4);
    border-radius: 12px;

    background: var(--bg-soft, #f8fafc);
    text-align: center;
}

.article-comments-empty > div {
    display: grid;
    place-items: center;

    width: 47px;
    height: 47px;
    margin: 0 auto 12px;

    border-radius: 50%;

    background: var(--surface, #ffffff);
    color: var(--primary, #2563eb);

    font-size: 1.6rem;
}

.article-comments-empty h3 {
    margin: 0;

    color: var(--text, #172033);

    font-size: 1.02rem;
}

.article-comments-empty p {
    margin: 7px 0 0;

    color: var(--text-soft, #64748b);

    font-size: 0.86rem;
    line-height: 1.6;
}

/* Планшеты и телефоны */

@media (max-width: 850px) {
    .article-detail-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .article-sidebar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .article-sidebar {
        grid-template-columns: minmax(0, 1fr);
    }

    .article-detail-hero {
        min-height: 0;
        padding: 25px 22px;
        border-radius: 18px;
    }

    .article-detail-hero-symbol {
        width: 68px;
        border-radius: 19px;
    }

    .article-comment-form-footer {
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .article-detail-hero {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 18px;
    }

    .article-detail-hero-symbol {
        width: 58px;
        border-radius: 16px;
        font-size: 1.8rem;
    }

    .article-form-field input {
        max-width: 100%;
    }

    .article-comment-form-footer > button {
        width: 100%;
    }

    .article-comment {
        gap: 10px;
        padding: 14px;
    }

    .article-comment-avatar {
        flex-basis: 35px;
        width: 35px;
        height: 35px;
    }
}

/* Тёмная тема */

html[data-theme="dark"] .article-detail-hero,
html[data-theme="dark"] .article-body-card,
html[data-theme="dark"] .article-rating-card,
html[data-theme="dark"] .article-comments-card {
    box-shadow: none;
}

html[data-theme="dark"] .article-feedback-success {
    border-color: #166534;
    background: #123322;
    color: #bbf7d0;
}

html[data-theme="dark"] .article-feedback-error {
    border-color: #7f1d1d;
    background: #3b1419;
    color: #fecaca;
}

@media (prefers-reduced-motion: reduce) {
    .article-rating-stars button {
        transition: none;
    }
}
