/* ============================================================
   BigBoss — базовые стили
   ============================================================ */

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #222;
    background: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4 {
    margin: 1.5rem 0 0.75rem;
    line-height: 1.2;
}

p {
    margin: 0 0 1rem;
}

/* ── Layout ─────────────────────────────────────────────────── */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.site-main {
    flex: 1;
    padding: 2rem 0;
}

/* ── Header ─────────────────────────────────────────────────── */

.site-header {
    background: #1a1a1a;
    color: #fff;
    padding: 1rem 0;
    border-bottom: 1px solid #333;
}

.site-header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.site-logo {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
}

.site-logo:hover {
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.site-nav a {
    color: #fff;
    font-size: 0.95rem;
}

.site-nav a:hover {
    color: #66b3ff;
    text-decoration: none;
}

.lang-switcher {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.lang-switcher a {
    color: #aaa;
    padding: 0.25rem 0.5rem;
    border: 1px solid #444;
    border-radius: 3px;
}

.lang-switcher a:hover {
    color: #fff;
    border-color: #fff;
    text-decoration: none;
}

.lang-switcher a.active {
    color: #fff;
    background: #444;
    border-color: #444;
}

/* ── Footer ─────────────────────────────────────────────────── */

.site-footer {
    background: #f4f4f4;
    border-top: 1px solid #ddd;
    padding: 2rem 0;
    color: #666;
    font-size: 0.9rem;
}

.site-footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ── Карточки контента ──────────────────────────────────────── */

.card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 0;
    list-style: none;
    margin: 1rem 0 2rem;
}

.card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.card__image {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: #f0f0f0;
}

.card__body {
    padding: 1rem 1.25rem;
}

.card__title {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.card__title a {
    color: #222;
}

.card__meta {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.card__excerpt {
    color: #444;
    margin: 0;
    font-size: 0.9rem;
}

/* ── Breadcrumbs ────────────────────────────────────────────── */

.breadcrumbs {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 1.5rem;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}

.breadcrumbs li::after {
    content: "/";
    color: #ccc;
    margin-left: 0.5rem;
}

.breadcrumbs li:last-child::after {
    display: none;
}

.breadcrumbs a {
    color: #888;
}

/* ── Контент Editor.js ──────────────────────────────────────── */

.content figure {
    margin: 1.5rem 0;
}

.content figure img {
    border-radius: 4px;
    margin: 0 auto;
}

.content figcaption {
    text-align: center;
    color: #666;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-style: italic;
}

.content blockquote {
    border-left: 4px solid #ddd;
    padding-left: 1rem;
    color: #555;
    margin: 1.5rem 0;
}

.content pre {
    background: #f4f4f4;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.9rem;
}

.content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.content th, .content td {
    border: 1px solid #ddd;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.content th {
    background: #f9f9f9;
    font-weight: 600;
}

/* ── 404 ────────────────────────────────────────────────────── */

.error-page {
    text-align: center;
    padding: 4rem 1rem;
}

.error-page h1 {
    font-size: 4rem;
    margin: 0;
    color: #ccc;
}

.error-page p {
    font-size: 1.1rem;
    color: #666;
}

/* ── Адаптив ────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .site-header__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .site-nav {
        gap: 1rem;
        font-size: 0.9rem;
    }
}

/* ── FAQ (раскрывающиеся вопросы) ───────────────────────────── */
.faq {
    margin: 2rem 0;
}
.faq > h2 {
    margin-bottom: 1rem;
}
.faq details {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin-bottom: .75rem;
    overflow: hidden;
}
.faq summary {
    padding: 1rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    background: #f9f9f9;
    list-style: none;
    position: relative;
    padding-right: 3rem;
    user-select: none;
}
.faq summary::-webkit-details-marker {
    display: none;
}
.faq summary::after {
    content: "+";
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem;
    color: #999;
}
.faq details[open] summary::after {
    content: "\2212";
}
.faq details[open] summary {
    border-bottom: 1px solid #e5e5e5;
}
.faq details p {
    padding: 1rem 1.25rem;
    margin: 0;
    color: #444;
    line-height: 1.6;
}

/* ── Меню сайта (renderMenu) ─────────────────────────────────── */
.site-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}
.site-menu > li { position: relative; }
.site-menu a {
    color: inherit;
    text-decoration: none;
    padding: .25rem 0;
    display: inline-block;
}
.site-menu a:hover { color: var(--accent, #2563eb); }

/* Подменю */
.site-menu__sub {
    position: absolute;
    top: 100%;
    left: 0;
    list-style: none;
    margin: 0;
    padding: .5rem 0;
    min-width: 180px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    border-radius: .35rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .15s, transform .15s, visibility .15s;
    z-index: 100;
}
.site-menu__has-children:hover > .site-menu__sub {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.site-menu__sub li { padding: 0 1rem; }
.site-menu__sub a { padding: .35rem 0; }

/* Вложенное подменю — справа от родителя */
.site-menu__sub .site-menu__sub {
    top: 0;
    left: 100%;
    margin-left: 0;
}

@media (max-width: 768px) {
    .site-menu {
        flex-direction: column;
        align-items: flex-start;
        gap: .5rem;
    }
    .site-menu__sub {
        position: static;
        opacity: 1; visibility: visible; transform: none;
        box-shadow: none;
        padding: .25rem 0 .25rem 1rem;
        background: transparent;
    }
}

/* ── Блок "Об авторе" под статьёй ──────────────────────────── */
.author-card {
    display: flex;
    gap: 1.25rem;
    margin: 2.5rem 0 1.5rem;
    padding: 1.25rem 1.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: .75rem;
}
.author-card__avatar { flex-shrink: 0; }
.author-card__avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
.author-card__body { flex: 1; min-width: 0; }
.author-card__name {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: .35rem;
    color: #1f2937;
}
.author-card__bio {
    color: #475569;
    line-height: 1.5;
    margin-bottom: .75rem;
    font-size: .95rem;
}
.author-card__links {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}
.author-card__social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #475569;
    transition: all .15s;
}
.author-card__social:hover {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    transform: translateY(-1px);
}
.author-card__social svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 600px) {
    .author-card {
        flex-direction: column;
        text-align: center;
        align-items: center;
        gap: 1rem;
    }
    .author-card__links { justify-content: center; }
}

/* ── Связанные статьи ────────────────────────────────────────── */
.related-posts {
    margin: 2.5rem 0 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}
.related-posts__title {
    font-size: 1.35rem;
    margin: 0 0 1rem;
    color: #1f2937;
}
.related-posts__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}
.related-posts__item {
    display: block;
    color: inherit;
    text-decoration: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: .5rem;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}
.related-posts__item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.related-posts__image-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f1f5f9;
}
.related-posts__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.related-posts__name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    padding: .75rem 1rem 1rem;
    color: #1f2937;
    line-height: 1.4;
}

@media (max-width: 600px) {
    .related-posts__grid { grid-template-columns: 1fr; }
}

/* ── Пагинация категорий ─────────────────────────────────────── */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: center;
    align-items: center;
    margin: 2rem 0 1rem;
}
.pagination__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 .65rem;
    border-radius: .35rem;
    text-decoration: none;
    color: #1f2937;
    background: #fff;
    border: 1px solid #cbd5e1;
    font-weight: 500;
    transition: all .15s;
}
.pagination__link:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.pagination__link--active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    cursor: default;
}
.pagination__ellipsis {
    padding: 0 .35rem;
    color: #94a3b8;
}

/* ── TOC (Table of Contents) ─────────────────────────────────── */
.toc {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-left: 3px solid #2563eb;
    border-radius: .35rem;
}
.toc__title {
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.toc__title::-webkit-details-marker { display: none; }
.toc__title::before {
    content: "▾";
    font-size: .8em;
    transition: transform .15s;
    color: #2563eb;
}
.toc:not([open]) > .toc__title::before {
    transform: rotate(-90deg);
}
.toc__list,
.toc__sublist {
    list-style: decimal;
    margin: .75rem 0 0;
    padding-left: 1.5rem;
}
.toc__sublist {
    list-style: lower-alpha;
    margin: .25rem 0 .25rem;
}
.toc__item {
    margin: .25rem 0;
    line-height: 1.4;
}
.toc__link {
    color: #1f2937;
    text-decoration: none;
}
.toc__link:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Плавный скролл к якорю */
html { scroll-behavior: smooth; }

/* ── Кнопки шеринга ──────────────────────────────────────────── */
.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin: 1.5rem 0;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #475569;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    padding: 0;
}
.share-btn svg { width: 20px; height: 20px; }
.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.share-btn--telegram:hover { background: #229ED9; color: #fff; border-color: #229ED9; }
.share-btn--whatsapp:hover { background: #25D366; color: #fff; border-color: #25D366; }
.share-btn--viber:hover    { background: #7360F2; color: #fff; border-color: #7360F2; }
.share-btn--twitter:hover  { background: #000;    color: #fff; border-color: #000; }
.share-btn--facebook:hover { background: #1877F2; color: #fff; border-color: #1877F2; }
.share-btn--vk:hover       { background: #0077FF; color: #fff; border-color: #0077FF; }
.share-btn--ok:hover       { background: #EE8208; color: #fff; border-color: #EE8208; }
.share-btn--copy:hover     { background: #2563eb; color: #fff; border-color: #2563eb; }
.share-btn--copy.copied    { background: #10b981; color: #fff; border-color: #10b981; }

/* ── Кнопка "Наверх" ─────────────────────────────────────────── */
.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .25s, transform .25s, visibility .25s, background .15s;
    z-index: 200;
    padding: 0;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:hover { background: #1d4ed8; }
.back-to-top svg { width: 22px; height: 22px; }

@media (max-width: 600px) {
    .back-to-top {
        right: 1rem;
        bottom: 1rem;
        width: 40px;
        height: 40px;
    }
}